mygs.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  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"><image class="goback" src="../../static/icon/fanhui.png" mode=""></image></view>
  7. <view class="header">我的收益</view>
  8. </view>
  9. <view class="content-bg"><image src="../../static/img/gssy.png" mode=""></image></view>
  10. <view class="money-box">
  11. <view class="money">{{ userInfo.profit }}</view>
  12. <view>总收益</view>
  13. </view>
  14. </view>
  15. <scroll-view :style="{ height: maxheight }" class="list-scroll-content" scroll-y @scrolltolower="loadData">
  16. <!-- 空白页 -->
  17. <empty v-if="orderList.length === 0"></empty>
  18. <!-- 订单列表 -->
  19. <view v-else>
  20. <view v-for="(item, index) in orderList" :key="index" class="order-item">
  21. <view class="i-top b-b">
  22. <text class="time">{{ item.order_id }}</text>
  23. <text class="state" :style="{ color: item.stateTipColor }">{{ item.stateTip }}</text>
  24. </view>
  25. <view class="goods-box-single">
  26. <image class="goods-img" :src="item.image" mode="aspectFill"></image>
  27. <view class="right">
  28. <text class="title clamp">{{ item.name }}</text>
  29. <text class="attr-box">x1</text>
  30. <text class="price">{{ moneyNum(item.price) }}</text>
  31. </view>
  32. </view>
  33. <view class="price-box">
  34. <text class="num">1</text>
  35. 件商品 邮费
  36. <text class="price">0</text>
  37. 实付款
  38. <text class="price">{{ moneyNum(item.price) }}</text>
  39. </view>
  40. </view>
  41. <uni-load-more :status="loadingType"></uni-load-more>
  42. </view>
  43. </scroll-view>
  44. </view>
  45. </template>
  46. <script>
  47. import { seller } from '@/api/order.js';
  48. import { getMoneyStyle } from '@/utils/rocessor.js';
  49. import { mapState, mapMutations } from 'vuex';
  50. import uniLoadMore from '@/uview-ui/components/u-loadmore/u-loadmore.vue';
  51. import empty from '@/uview-ui/components/u-empty/u-empty.vue';
  52. export default {
  53. filters: {
  54. getMoneyStyle
  55. },
  56. computed: {
  57. ...mapState('user', ['userInfo', 'orderInfo', 'hasLogin'])
  58. },
  59. components: {
  60. empty,
  61. uniLoadMore
  62. },
  63. data() {
  64. return {
  65. maxheight:'',
  66. loadingType: 'more',
  67. orderList: [],
  68. page: 1, //当前页数
  69. limit: 10 //每次信息条数
  70. };
  71. },
  72. filters: {
  73. moneyNum(value) {
  74. return +value;
  75. }
  76. },
  77. onReady() {
  78. const that = this;
  79. uni.getSystemInfo({
  80. success: resu => {
  81. const query = uni.createSelectorQuery();
  82. query.select('.list-scroll-content').boundingClientRect();
  83. query.exec(function(res) {
  84. that.maxheight = resu.windowHeight - res[0].top + 'px';
  85. });
  86. },
  87. fail: res => {}
  88. });
  89. },
  90. onShow() {
  91. this.loadData();
  92. },
  93. methods: {
  94. // 转换金额为数字
  95. moneyNum(value) {
  96. return +value;
  97. },
  98. // 页面跳转
  99. navto(e) {
  100. uni.navigateTo({
  101. url: e
  102. });
  103. },
  104. // 点击返回 我的页面
  105. toBack() {
  106. uni.navigateBack({});
  107. },
  108. //获取收入支出信息
  109. async loadData(source) {
  110. let obj = this;
  111. if (obj.loadingType === 'loading'||obj.loadingType === 'nomore') {
  112. //防止重复加载
  113. return;
  114. }
  115. // 修改当前对象状态为加载中
  116. obj.loadingType = 'loading';
  117. seller({
  118. type: 3,
  119. page: obj.page,
  120. limit: obj.limit
  121. })
  122. .then(({ data }) => {
  123. let arr = data.map(e => {
  124. e.stateTip = '已完成';
  125. e.stateTipColor = '#909399';
  126. return e;
  127. });
  128. obj.orderList = obj.orderList.concat(arr);
  129. // console.log(navItem.orderList);
  130. obj.page++;
  131. if (obj.limit == data.length) {
  132. //判断是否还有数据, 有改为 more, 没有改为noMore
  133. obj.loadingType = 'more';
  134. return;
  135. } else {
  136. //判断是否还有数据, 有改为 more, 没有改为noMore
  137. obj.loadingType = 'noMore';
  138. }
  139. uni.hideLoading();
  140. })
  141. .catch(e => {
  142. console.log(e);
  143. });
  144. },
  145. //swiper 切换
  146. changeTab(e) {
  147. this.tabCurrentIndex = e.target.current;
  148. this.loadData('tabChange');
  149. },
  150. //顶部tab点击
  151. tabClick(index) {
  152. this.tabCurrentIndex = index;
  153. }
  154. }
  155. };
  156. </script>
  157. <style lang="scss">
  158. page {
  159. background: #f1f1f1;
  160. height: 100%;
  161. }
  162. .status_bar {
  163. height: var(--status-bar-height);
  164. width: 100%;
  165. }
  166. .content-money {
  167. position: relative;
  168. height: 400rpx;
  169. .content-bg {
  170. position: absolute;
  171. top: 0;
  172. left: 0;
  173. right: 0;
  174. width: 750rpx;
  175. height: 400rpx;
  176. image {
  177. width: 100%;
  178. height: 100%;
  179. }
  180. }
  181. .body-title {
  182. height: 80rpx;
  183. text-align: center;
  184. font-size: 35rpx;
  185. position: relative;
  186. .header {
  187. position: absolute;
  188. left: 0;
  189. top: 0;
  190. width: 100%;
  191. font-size: 36rpx;
  192. font-family: PingFang SC;
  193. font-weight: bold;
  194. color: #fffeff;
  195. height: 80rpx;
  196. font-size: 36rpx;
  197. font-weight: 700;
  198. z-index: 9;
  199. display: flex;
  200. justify-content: center;
  201. align-items: center;
  202. }
  203. .goback-box {
  204. position: absolute;
  205. left: 18rpx;
  206. top: 0;
  207. height: 80rpx;
  208. display: flex;
  209. align-items: center;
  210. }
  211. .goback {
  212. z-index: 100;
  213. width: 34rpx;
  214. height: 34rpx;
  215. }
  216. }
  217. }
  218. .info-box {
  219. width: 670rpx;
  220. height: 186rpx;
  221. background: #ffffff;
  222. box-shadow: 0px 0px 20rpx 0px rgba(50, 50, 52, 0.06);
  223. border-radius: 20rpx;
  224. margin: -100rpx auto 0;
  225. position: relative;
  226. z-index: 2;
  227. .info-item {
  228. width: 50%;
  229. display: flex;
  230. flex-direction: column;
  231. align-items: center;
  232. line-height: 1;
  233. .info-font {
  234. font-size: 30rpx;
  235. font-family: PingFang SC;
  236. font-weight: bold;
  237. color: #999999;
  238. }
  239. .info-num {
  240. margin-top: 30rpx;
  241. font-size: 30rpx;
  242. font-family: PingFang SC;
  243. font-weight: bold;
  244. color: #181818;
  245. }
  246. }
  247. .shu {
  248. width: 2rpx;
  249. height: 74rpx;
  250. background: #dcdfe6;
  251. }
  252. }
  253. .money-box {
  254. position: relative;
  255. z-index: 2;
  256. padding-top: 90rpx;
  257. color: #ffffff;
  258. text-align: center;
  259. .money {
  260. font-size: 72rpx;
  261. font-family: PingFang SC;
  262. font-weight: bold;
  263. color: #ffffff;
  264. }
  265. .text {
  266. font-size: 30rpx;
  267. }
  268. }
  269. .list-scroll-content {
  270. height: calc(100% - 175px);
  271. }
  272. .order-item {
  273. display: flex;
  274. flex-direction: column;
  275. background: #fff;
  276. margin-top: 16rpx;
  277. .i-top {
  278. display: flex;
  279. align-items: center;
  280. height: 80rpx;
  281. font-size: $font-base;
  282. color: $font-color-dark;
  283. position: relative;
  284. padding: 0 30rpx;
  285. .time {
  286. flex: 1;
  287. }
  288. .state {
  289. color: $base-color;
  290. }
  291. .del-btn {
  292. padding: 10rpx 0 10rpx 36rpx;
  293. font-size: $font-lg;
  294. color: $font-color-light;
  295. position: relative;
  296. &:after {
  297. content: '';
  298. width: 0;
  299. height: 30rpx;
  300. border-left: 1px solid $border-color-dark;
  301. position: absolute;
  302. left: 20rpx;
  303. top: 50%;
  304. transform: translateY(-50%);
  305. }
  306. }
  307. }
  308. /* 多条商品 */
  309. .goods-box {
  310. height: 160rpx;
  311. padding: 20rpx 0;
  312. white-space: nowrap;
  313. .goods-item {
  314. width: 120rpx;
  315. height: 120rpx;
  316. display: inline-block;
  317. margin-right: 24rpx;
  318. }
  319. .goods-img {
  320. display: block;
  321. width: 100%;
  322. height: 100%;
  323. }
  324. }
  325. /* 单条商品 */
  326. .goods-box-single {
  327. display: flex;
  328. padding: 20rpx 30rpx;
  329. background: #f7f7f7;
  330. .goods-img {
  331. display: block;
  332. width: 120rpx;
  333. height: 120rpx;
  334. }
  335. .right {
  336. flex: 1;
  337. display: flex;
  338. flex-direction: column;
  339. padding: 0 0 0 24rpx;
  340. overflow: hidden;
  341. .row {
  342. margin-top: 10rpx;
  343. }
  344. .row_title {
  345. padding: 5rpx 10rpx;
  346. background-color: #dddddd;
  347. border-radius: 10rpx;
  348. font-size: 22rpx;
  349. color: #ffffff;
  350. }
  351. .title {
  352. font-size: $font-base + 2rpx;
  353. color: $font-color-dark;
  354. line-height: 1;
  355. width: 80%;
  356. }
  357. .attr-box {
  358. display: flex;
  359. justify-content: flex-end;
  360. font-size: $font-sm + 2rpx;
  361. color: $font-color-light;
  362. }
  363. .price {
  364. display: inline;
  365. font-size: $font-base + 2rpx;
  366. color: $font-color-dark;
  367. &:before {
  368. content: '¥';
  369. font-size: $font-sm;
  370. }
  371. }
  372. }
  373. }
  374. .buy-box {
  375. height: 84rpx;
  376. padding: 0 22rpx;
  377. background-color: #ffffff;
  378. .buy-info {
  379. height: 100%;
  380. display: flex;
  381. align-items: center;
  382. .font {
  383. font-size: 32rpx;
  384. font-family: PingFang SC;
  385. font-weight: 500;
  386. color: #333333;
  387. }
  388. .avter {
  389. margin-left: 10rpx;
  390. width: 46rpx;
  391. height: 46rpx;
  392. border-radius: 50%;
  393. }
  394. .buy-name {
  395. margin-left: 10rpx;
  396. font-size: 32rpx;
  397. font-family: PingFang SC;
  398. font-weight: bold;
  399. color: #333333;
  400. }
  401. .phone {
  402. margin-left: 12rpx;
  403. font-size: 24rpx;
  404. font-family: PingFang SC;
  405. font-weight: 500;
  406. color: #999999;
  407. }
  408. }
  409. }
  410. .upimg {
  411. padding-left: 20rpx;
  412. padding-top: 10rpx;
  413. padding-bottom: 10rpx;
  414. display: flex;
  415. .up-tit {
  416. display: inline-block;
  417. font-size: 26rpx;
  418. font-family: PingFang SC;
  419. font-weight: 500;
  420. color: #6d7c88;
  421. }
  422. .img-wrap {
  423. width: 153rpx;
  424. height: 152rpx;
  425. border-radius: 20rpx;
  426. image {
  427. border-radius: 20rpx;
  428. width: 153rpx;
  429. height: 152rpx;
  430. background-color: #ccc;
  431. }
  432. }
  433. }
  434. .price-box {
  435. display: flex;
  436. justify-content: flex-end;
  437. align-items: baseline;
  438. padding: 20rpx 30rpx;
  439. font-size: $font-sm + 2rpx;
  440. color: $font-color-light;
  441. .num {
  442. margin: 0 8rpx;
  443. color: $font-color-dark;
  444. }
  445. .price {
  446. font-size: $font-lg;
  447. color: $font-color-dark;
  448. &:before {
  449. content: '¥';
  450. font-size: $font-sm;
  451. margin: 0 2rpx 0 8rpx;
  452. }
  453. }
  454. }
  455. .action-box {
  456. padding: 0 30rpx;
  457. display: flex;
  458. justify-content: flex-end;
  459. align-items: center;
  460. height: 100rpx;
  461. position: relative;
  462. }
  463. .refuse {
  464. margin: 0;
  465. padding: 0;
  466. width: 160rpx;
  467. height: 60rpx;
  468. border: 2rpx solid #ebebeb;
  469. border-radius: 28rpx;
  470. text-align: center;
  471. line-height: 60rpx;
  472. font-size: 26rpx;
  473. font-family: PingFang SC;
  474. font-weight: 500;
  475. color: #999999;
  476. &:after {
  477. border-radius: 100px;
  478. }
  479. &.recom {
  480. color: #999999;
  481. &:after {
  482. border-color: #999999;
  483. }
  484. }
  485. }
  486. .action-btn {
  487. width: 160rpx;
  488. height: 60rpx;
  489. margin: 0;
  490. margin-left: 24rpx;
  491. padding: 0;
  492. text-align: center;
  493. line-height: 60rpx;
  494. font-size: $font-sm + 2rpx;
  495. color: $font-color-dark;
  496. background: #fff;
  497. border-radius: 100px;
  498. border: 2rpx solid #fd3b39;
  499. border-radius: 28px;
  500. &:after {
  501. border-radius: 100px;
  502. }
  503. &.recom {
  504. color: $base-color;
  505. &:after {
  506. border-color: $base-color;
  507. }
  508. }
  509. &.evaluate {
  510. color: $color-yellow;
  511. &:after {
  512. border-color: $color-yellow;
  513. }
  514. }
  515. }
  516. }
  517. </style>