mytihuolist.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <view class="status_bar"><!-- 这里是状态栏 --></view>
  5. <view class="body-title">
  6. <view class="goback-box" @click="toBack">
  7. <image class="goback" src="../../static/icon/fanhui.png" mode=""></image>
  8. </view>
  9. <view class="header">提货积分</view>
  10. </view>
  11. <view class="content-bg">
  12. <image src="../../static/img/gssy.png" mode=""></image>
  13. </view>
  14. <view class="money-box">
  15. <view class="money">{{ userInfo.good_integral }}</view>
  16. <view>余额</view>
  17. </view>
  18. </view>
  19. <view class="titlebox flex-center padding-t-30 padding-b-30">
  20. <view class="rich">
  21. <view class="richmin left">
  22. </view>
  23. </view>
  24. <view class="name">
  25. 产品交付区
  26. </view>
  27. <view class="rich right">
  28. <view class="richmin right">
  29. </view>
  30. </view>
  31. </view>
  32. <scroll-view :style="{ height: maxheight }" class="list-scroll-content" scroll-y @scrolltolower="loadData">
  33. <!-- 空白页 -->
  34. <empty v-if="orderList.length === 0"></empty>
  35. <!-- 订单列表 -->
  36. <view v-else>
  37. <view class="list">
  38. <view v-for="(item, index) in orderList" :key="index" class="priduct-item">
  39. <view class="priduct-main-image">
  40. <image :src="item.image" mode="aspectFill"></image>
  41. </view>
  42. <!-- <text class="title clamp">{{ item.title }}</text> -->
  43. <view class="priduct-main-name clamp2 margin-c-20">{{ item.title }}</view>
  44. <view class="priduct-main-price">
  45. <view class="price">
  46. <image class="instip" src="../../static/icon/quick1.png" mode="scaleToFill"></image>
  47. <text class="padding-l-10">
  48. {{ item.good_integral }}
  49. </text>
  50. <text class="font-size-sm">
  51. 积分
  52. </text>
  53. </view>
  54. </view>
  55. <view class="priduct-main-price">
  56. <view class="price">
  57. +
  58. <text class="padding-l-10">
  59. {{ item.integral }}
  60. </text>
  61. <text class="font-size-sm">
  62. 趣豆
  63. </text>
  64. </view>
  65. </view>
  66. <view class="flex padding-l-20 padding-b-20">
  67. <view class="buttom" @click="openPay(item)">
  68. 立即提货
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <uni-load-more :status="loadingType"></uni-load-more>
  74. </view>
  75. </scroll-view>
  76. </view>
  77. </template>
  78. <script>
  79. import {
  80. good_exchange
  81. } from '@/api/wallet.js';
  82. import {
  83. getMoneyStyle
  84. } from '@/utils/rocessor.js';
  85. import {
  86. mapState,
  87. mapMutations
  88. } from 'vuex';
  89. import {
  90. getUserInfo
  91. } from '@/api/user.js';
  92. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  93. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  94. export default {
  95. filters: {
  96. getMoneyStyle
  97. },
  98. computed: {
  99. ...mapState('user', ['userInfo'])
  100. },
  101. components: {
  102. empty,
  103. uniLoadMore
  104. },
  105. data() {
  106. return {
  107. loadingType: 'more',
  108. orderList: [],
  109. page: 1, //当前页数
  110. limit: 10, //每次信息条数
  111. maxheight: 0
  112. };
  113. },
  114. filters: {
  115. moneyNum(value) {
  116. return +value;
  117. }
  118. },
  119. onReady(res) {
  120. var _this = this;
  121. uni.getSystemInfo({
  122. success: resu => {
  123. const query = uni.createSelectorQuery();
  124. query.select('.list-scroll-content').boundingClientRect().exec(function(res) {
  125. _this.maxheight = resu.windowHeight - res[0].top + 'px';
  126. console.log('打印页面的剩余高度', _this.height);
  127. });
  128. },
  129. fail: res => {}
  130. });
  131. },
  132. onShow() {
  133. this.loadData();
  134. this.getUserInfo();
  135. },
  136. methods: {
  137. ...mapMutations('user', ['setUserInfo', 'setOrderInfo']),
  138. getUserInfo() {
  139. getUserInfo({})
  140. .then(({
  141. data
  142. }) => {
  143. this.setUserInfo(data);
  144. })
  145. .catch(e => {
  146. console.log(e);
  147. });
  148. },
  149. openPay(item){
  150. uni.navigateTo({
  151. url:"./goodProduct?id="+item.id
  152. })
  153. // uni.showModal({
  154. // title: '支付提示',
  155. // content: `是否立即兑换兑换`,
  156. // cancelText: '取消',
  157. // confirmText: '兑换',
  158. // success: res => {
  159. // if(res.confirm){
  160. // }
  161. // },
  162. // });
  163. },
  164. // 转换金额为数字
  165. moneyNum(value) {
  166. return +value;
  167. },
  168. // 页面跳转
  169. navto(e) {
  170. uni.navigateTo({
  171. url: e
  172. });
  173. },
  174. // 点击返回 我的页面
  175. toBack() {
  176. uni.navigateBack({});
  177. },
  178. //获取收入支出信息
  179. async loadData(source) {
  180. let obj = this;
  181. good_exchange({
  182. page: obj.page,
  183. limit: obj.limit
  184. })
  185. .then(({
  186. data
  187. }) => {
  188. obj.orderList = obj.orderList.concat(data);
  189. // console.log(navItem.orderList);
  190. obj.page++;
  191. if (obj.limit == data.length) {
  192. //判断是否还有数据, 有改为 more, 没有改为noMore
  193. obj.loadingType = 'more';
  194. return;
  195. } else {
  196. //判断是否还有数据, 有改为 more, 没有改为noMore
  197. obj.loadingType = 'noMore';
  198. }
  199. uni.hideLoading();
  200. })
  201. .catch(e => {
  202. console.log(e);
  203. });
  204. },
  205. //swiper 切换
  206. changeTab(e) {
  207. this.tabCurrentIndex = e.target.current;
  208. this.loadData('tabChange');
  209. },
  210. //顶部tab点击
  211. tabClick(index) {
  212. this.tabCurrentIndex = index;
  213. }
  214. }
  215. };
  216. </script>
  217. <style lang="scss">
  218. page {
  219. background: #f1f1f1;
  220. height: 100%;
  221. }
  222. .titlebox {
  223. .rich {
  224. width: 20rpx;
  225. height: 20rpx;
  226. background: #FFA5A5;
  227. border-radius: 50%;
  228. position: relative;
  229. .richmin {
  230. width: 14rpx;
  231. height: 14rpx;
  232. border-radius: 50%;
  233. border: 1px solid #333333;
  234. &.left {
  235. position: absolute;
  236. left: -4rpx;
  237. bottom: -4rpx;
  238. }
  239. &.right {
  240. position: absolute;
  241. right: -4rpx;
  242. bottom: -4rpx;
  243. }
  244. }
  245. }
  246. .name {
  247. color: #FF6B2E;
  248. font-weight: 500;
  249. font-size: 33rpx;
  250. padding: 0 40rpx;
  251. }
  252. }
  253. .status_bar {
  254. height: var(--status-bar-height);
  255. width: 100%;
  256. }
  257. .content-money {
  258. position: relative;
  259. height: 400rpx;
  260. .content-bg {
  261. position: absolute;
  262. top: 0;
  263. left: 0;
  264. right: 0;
  265. width: 750rpx;
  266. height: 400rpx;
  267. image {
  268. width: 100%;
  269. height: 100%;
  270. }
  271. }
  272. .body-title {
  273. height: 80rpx;
  274. text-align: center;
  275. font-size: 35rpx;
  276. position: relative;
  277. .header {
  278. position: absolute;
  279. left: 0;
  280. top: 0;
  281. width: 100%;
  282. font-size: 36rpx;
  283. font-family: PingFang SC;
  284. font-weight: bold;
  285. color: #fffeff;
  286. height: 80rpx;
  287. font-size: 36rpx;
  288. font-weight: 700;
  289. z-index: 9;
  290. display: flex;
  291. justify-content: center;
  292. align-items: center;
  293. }
  294. .goback-box {
  295. position: absolute;
  296. left: 18rpx;
  297. top: 0;
  298. height: 80rpx;
  299. display: flex;
  300. align-items: center;
  301. }
  302. .goback {
  303. z-index: 100;
  304. width: 34rpx;
  305. height: 34rpx;
  306. }
  307. }
  308. }
  309. .money-box {
  310. position: relative;
  311. z-index: 2;
  312. padding-top: 90rpx;
  313. color: #ffffff;
  314. text-align: center;
  315. .money {
  316. font-size: 72rpx;
  317. font-family: PingFang SC;
  318. font-weight: bold;
  319. color: #ffffff;
  320. }
  321. .text {
  322. font-size: 30rpx;
  323. }
  324. }
  325. .list {
  326. width: 100%;
  327. display: flex;
  328. flex-wrap: wrap;
  329. padding: 0 32rpx;
  330. .priduct-item {
  331. width: 48%;
  332. background-color: #ffffff;
  333. border-radius: 12rpx;
  334. margin-bottom: 24rpx;
  335. &:nth-child(2n + 1) {
  336. margin-right: 24rpx;
  337. }
  338. .buttom{
  339. color: #fffeff;
  340. background-color:#FF6B2E ;
  341. padding: 6rpx 20rpx;
  342. border-radius: 100rpx;
  343. }
  344. .priduct-main-image {
  345. width: 100%;
  346. height: 330rpx;
  347. // background: red;
  348. border-radius: 3px;
  349. overflow: hidden;
  350. image {
  351. width: 100%;
  352. height: 100%;
  353. opacity: 1;
  354. border-radius: 12rpx 12rpx 0 0;
  355. }
  356. }
  357. .priduct-main-name {
  358. font-size: $font-base;
  359. color: $font-color-dark;
  360. font-weight: bold;
  361. height: 3em;
  362. }
  363. .priduct-main-price {
  364. display: flex;
  365. justify-content: space-between;
  366. padding: 0 16rpx 12rpx;
  367. .price {
  368. font-size: 36rpx;
  369. font-weight: bold;
  370. color: #FF6B2E;
  371. .instip{
  372. width: 30rpx;
  373. height: 30rpx;
  374. }
  375. }
  376. }
  377. }
  378. }
  379. </style>