scoreAccumulate.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="content">
  3. <!-- <view class="navbar">
  4. <view v-for="(item, index) in navList" :key="index" class="nav-item" :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.text }}</view>
  5. </view> -->
  6. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  7. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  8. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="loadData">
  9. <!-- 空白页 -->
  10. <empty v-if="tabItem.loaded === true && tabItem.orderList.length === 0"></empty>
  11. <!-- 订单列表 -->
  12. <view v-for="(item, index) in tabItem.orderList" :key="index" class="order-item flex">
  13. <view class="title-box">
  14. <view class="title">
  15. <text>{{ item.mark }}</text>
  16. </view>
  17. <view class="time">
  18. <text>{{ item.add_time }}</text>
  19. </view>
  20. </view>
  21. <view class="money">
  22. <text>{{ (item.pm == 0 ? '-' : '+') + item.number }}</text>
  23. </view>
  24. </view>
  25. <uni-load-more :status="tabItem.loadingType"></uni-load-more>
  26. </scroll-view>
  27. </swiper-item>
  28. </swiper>
  29. <view class="bottom-box">
  30. <button class="add-btn up" @click="confirmShow">积分转佣金</button>
  31. <navigator url="./setintegral">
  32. <button class="add-btn yue" >积分转账</button>
  33. </navigator>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { integrallist } from '@/api/functionalUnit.js';
  39. import empty from '@/components/empty/empty.vue';
  40. import {
  41. getUserInfo
  42. } from '@/api/user.js';
  43. import {
  44. mapState,
  45. mapMutations
  46. } from 'vuex';
  47. export default {
  48. components: {
  49. empty
  50. },
  51. computed: {
  52. ...mapState('user', ['userInfo'])
  53. },
  54. data() {
  55. return {
  56. tabCurrentIndex: 0,
  57. navList: [
  58. {
  59. state: 0,
  60. text: '全部',
  61. loadingType: 'more',
  62. orderList: [],
  63. page: 1, //当前页数
  64. limit: 10 //每次信息条数
  65. },
  66. ],
  67. };
  68. },
  69. onShow() {
  70. // 载入积分数据
  71. this.loadData();
  72. this.loadBaseData();
  73. },
  74. methods: {
  75. ...mapMutations('user', ['setUserInfo']),
  76. // 重新获取用户数据
  77. loadBaseData() {
  78. getUserInfo({})
  79. .then(({
  80. data
  81. }) => {
  82. console.log(data.nickname)
  83. this.setUserInfo(data);
  84. })
  85. .catch(e => {
  86. console.log(e);
  87. });
  88. },
  89. confirmShow(){
  90. uni.showModal({
  91. title: '积分转佣金',
  92. editable: true,
  93. placeholderText:'请输入要转换的积分',
  94. success: res => {
  95. if(res.confirm){
  96. // setMoney({
  97. // brokerage:+res.content/10
  98. // }).then((e)=>{
  99. // uni.showToast({
  100. // title: '积分转佣金完成'
  101. // });
  102. // }).catch((err)=>{
  103. // console.log(err);
  104. // })
  105. }
  106. },
  107. fail: () => {},
  108. complete: () => {}
  109. });
  110. },
  111. // 页面跳转
  112. navto(e) {
  113. uni.navigateTo({
  114. url: e
  115. });
  116. },
  117. //获取收入支出信息
  118. async loadData(source) {
  119. //这里是将订单挂载到tab列表下
  120. let index = this.tabCurrentIndex;
  121. let navItem = this.navList[index];
  122. let state = navItem.state;
  123. if (source === 'tabChange' && navItem.loaded === true) {
  124. //tab切换只有第一次需要加载数据
  125. return;
  126. }
  127. if (navItem.loadingType === 'loading') {
  128. //防止重复加载
  129. return;
  130. }
  131. // 修改当前对象状态为加载中
  132. navItem.loadingType = 'loading';
  133. integrallist(
  134. {
  135. page: navItem.page,
  136. limit: navItem.limit
  137. },
  138. state
  139. )
  140. .then(({ data }) => {
  141. if (data.length > 0) {
  142. navItem.orderList = navItem.orderList.concat(data);
  143. navItem.page++;
  144. }
  145. if (navItem.limit == data.length) {
  146. //判断是否还有数据, 有改为 more, 没有改为noMore
  147. navItem.loadingType = 'more';
  148. return;
  149. } else {
  150. //判断是否还有数据, 有改为 more, 没有改为noMore
  151. navItem.loadingType = 'noMore';
  152. }
  153. uni.hideLoading();
  154. this.$set(navItem, 'loaded', true);
  155. })
  156. .catch(e => {
  157. console.log(e);
  158. });
  159. },
  160. //swiper 切换
  161. changeTab(e) {
  162. this.tabCurrentIndex = e.target.current;
  163. this.loadData('tabChange');
  164. },
  165. //顶部tab点击
  166. tabClick(index) {
  167. this.tabCurrentIndex = index;
  168. }
  169. }
  170. };
  171. </script>
  172. <style lang="scss">
  173. page {
  174. background: #ffffff;
  175. height: 100%;
  176. }
  177. .navbar {
  178. display: flex;
  179. height: 40px;
  180. padding: 0 5px;
  181. background: #fff;
  182. box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
  183. position: relative;
  184. z-index: 10;
  185. .nav-item {
  186. flex: 1;
  187. display: flex;
  188. justify-content: center;
  189. align-items: center;
  190. height: 100%;
  191. font-size: 15px;
  192. color: $font-color-dark;
  193. position: relative;
  194. &.current {
  195. color: $base-color;
  196. &:after {
  197. content: '';
  198. position: absolute;
  199. left: 50%;
  200. bottom: 0;
  201. transform: translateX(-50%);
  202. width: 44px;
  203. height: 0;
  204. border-bottom: 2px solid $base-color;
  205. }
  206. }
  207. }
  208. }
  209. // 列表
  210. .swiper-box {
  211. height: calc(100% - 44px);
  212. padding-top: 10rpx;
  213. .order-item {
  214. padding: 20rpx 30rpx;
  215. line-height: 1.5;
  216. .title-box {
  217. .title {
  218. font-size: $font-lg;
  219. color: $font-color-base;
  220. }
  221. .time {
  222. font-size: $font-base;
  223. color: $font-color-light;
  224. }
  225. }
  226. .money {
  227. color: #fd5b23;
  228. font-size: $font-lg;
  229. }
  230. }
  231. }
  232. .list-scroll-content {
  233. height: 100%;
  234. }
  235. .content {
  236. height: 100%;
  237. .empty-content {
  238. background-color: #ffffff;
  239. }
  240. }
  241. .bottom-box{
  242. position: absolute;
  243. bottom: 0;
  244. left:0;
  245. right:0;
  246. padding-bottom: 30rpx;
  247. }
  248. .add-btn {
  249. color:#FFF;
  250. &.yue{
  251. background-color: #FFF;
  252. color: #6B4216;
  253. }
  254. &.up {
  255. background: linear-gradient(-90deg, #FAC545, #FFE000);
  256. }
  257. display: flex;
  258. align-items: center;
  259. justify-content: center;
  260. width: 604rpx;
  261. height: 90rpx;
  262. margin: 0 auto;
  263. margin-top: 30rpx;
  264. font-size: $font-lg;
  265. border-radius: 10rpx;
  266. }
  267. .popup-box {
  268. width: 522rpx;
  269. height: 605rpx;
  270. background-color: #ffffff;
  271. border-radius: 20rpx;
  272. position: relative;
  273. .title{
  274. text-align: center;
  275. }
  276. .mian {
  277. display: flex;
  278. flex-direction: column;
  279. align-items: center;
  280. // padding: 32rpx 32rpx;
  281. background-color: #ffffff;
  282. border-radius: 0 0 20rpx 20rpx;
  283. text-align: center;
  284. .delivery {
  285. font-size: 40rpx;
  286. color: #333333;
  287. display: flex;
  288. align-items: center;
  289. flex-direction: column;
  290. image {
  291. margin-top: 48rpx;
  292. width: 172rpx;
  293. height: 160rpx;
  294. }
  295. }
  296. .nocancel {
  297. font-size: 32rpx;
  298. color: #333333;
  299. margin-top: 14rpx;
  300. }
  301. .comfirm-box {
  302. margin-top: 52rpx;
  303. display: flex;
  304. // margin-bottom: 32rpx;
  305. // justify-content: space-around;
  306. .cancel {
  307. display: flex;
  308. align-items: center;
  309. justify-content: center;
  310. width: 197rpx;
  311. height: 74rpx;
  312. border: 1px solid #dcc786;
  313. border-radius: 38rpx;
  314. font-size: 32rpx;
  315. color: #605128;
  316. }
  317. .comfirm {
  318. margin-left: 32rpx;
  319. display: flex;
  320. align-items: center;
  321. justify-content: center;
  322. width: 197rpx;
  323. height: 74rpx;
  324. background: linear-gradient(-90deg, #d1ba77 0%, #f7e8ad 100%);
  325. border-radius: 38px;
  326. font-size: 32rpx;
  327. color: #605128;
  328. }
  329. }
  330. }
  331. }
  332. </style>