award.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. <template>
  2. <view>
  3. <view class="app-bg">
  4. <image src="/static/img/detail_bg.png"></image>
  5. <view class="body fx-h fx-bc fx-ac">
  6. <view class="count">{{ user.award || 0 }}</view>
  7. <view class="label">我的奖金</view>
  8. </view>
  9. <!-- <view class="fukuan" @click="fukuan" style="position: absolute;right: 30rpx;top: 180rpx;">
  10. <image src="/static/img/fukuan.png" style="width: 50rpx;height: 50rpx;"></image>
  11. </view> -->
  12. </view>
  13. <uni-nav-bar color="#fff" :border="false" statusBar backgroundColor="transparent" left-icon="left"
  14. @clickLeft="utils.navigateBack()" fixed title="我的奖金"></uni-nav-bar>
  15. <view class="htop" :style="'height:calc(65vw - ' + statusBarHeight + 'px - 44px);'"></view>
  16. <view class="app-body">
  17. <!-- <view class="pannel fx-r fx-bc">
  18. <view class="item fx-h fx-bc fx-ac" @tap="tapSc">
  19. <image src="/static/img/detail_sc.png"></image>
  20. <view class="text">闪兑</view>
  21. </view>
  22. <view class="line"></view>
  23. <view class="item fx-h fx-bc fx-ac" @tap="TapZc">
  24. <image src="/static/img/detail_zc.png"></image>
  25. <view class="text">转水果</view>
  26. </view>
  27. <view class="line"></view>
  28. <view class="item fx-h fx-bc fx-ac" @tap="TapZchu">
  29. <image src="/static/img/detail_zchu.png" style="width: 50rpx;height: 50rpx;"></image>
  30. <view class="text">转臻选</view>
  31. </view>
  32. </view> -->
  33. <!--列表数据-->
  34. <view class="nav-list fx-r fx-bc">
  35. <view class="item fx-h fx-bc" @tap="tapNav(item.code)" :class="form.type == item.code ? 'active' : ''"
  36. v-for="(item,index) in navList">
  37. <view class="label">{{ item.name }}</view>
  38. <image class="icon" v-if="form.type == item.code" src="/static/img/detail_d.png"></image>
  39. </view>
  40. <view class="fx-g1"></view>
  41. <view class="time fx-r fx-bc" @tap="openintegralDate()">
  42. <view class="count">{{ form.dateStr || "" }}</view>
  43. <image class="icon" src="/static/img/detail_next.png"></image>
  44. </view>
  45. </view>
  46. <scroll-view scroll-y class="scroll" :style="'height: calc(100vh - 61vw - 100rpx - 130rpx);'"
  47. @scrolltolower="loadMoreData">
  48. <view class="sc-body">
  49. <view class="detail-list" v-if="data.length > 0">
  50. <view class="top fx-r">
  51. <view class="label">{{ this.form.dateStr }}</view>
  52. <view class="fx-g1"></view>
  53. <view class="label">收入:{{ this.total.inMoney || '0.00' }}
  54. 支出:{{ this.total.outMoney || '0.00' }}</view>
  55. </view>
  56. <view class="item fx-r fx-bc" v-for="(item,index) in data">
  57. <image class="icon" v-if="item.type == 0" src="/static/img/detail_in.png"></image>
  58. <image class="icon" v-if="item.type == 1" src="/static/img/detail_in.png"></image>
  59. <image class="icon" v-if="item.type == 2" src="/static/img/detail_out.png"></image>
  60. <view class="info">
  61. <view class="title">{{ item.title }}</view>
  62. <view class="tag">{{ item.content }}</view>
  63. <view class="time">{{ item.time }}</view>
  64. </view>
  65. <view class="fx-g1"></view>
  66. <view class="right fx-h">
  67. <view class="money" style="color:#e2a622;" v-if="item.type == 1">+{{item.v}}</view>
  68. <view class="money" v-if="item.type == 2">-{{item.v}}</view>
  69. <view class="fx-g1"></view>
  70. <view class="balance">余额:{{ item.money }}</view>
  71. </view>
  72. </view>
  73. </view>
  74. <view v-if="data.length > 0">
  75. <view class="loading fx-r fx-ac fx-bc" v-if="page.isFrite && !page.isFoot">
  76. <image src="/static/img/xloading.png"></image>
  77. <text>正在载入更多...</text>
  78. </view>
  79. <view class="loading complete" :hidden="!page.isFoot">已加载全部</view>
  80. </view>
  81. <uv-empty v-if="data.length == 0 && isFirst" mode="data" icon="/static/img/no-empty.png"></uv-empty>
  82. </view>
  83. </scroll-view>
  84. </view>
  85. <PayDialog ref="payDialog" @getPassword="getPassword"></PayDialog>
  86. <uv-datetime-picker ref='integralDate' v-model="datetime" @confirm="tapConfirm" mode="year-month"></uv-datetime-picker>
  87. <uv-popup ref='payPopup' @close="payPopupClose()" mode="center">
  88. <view class="codeBox">
  89. <tki-qrcode v-if="ifShow" cid="qrcode1" ref="qrcode" :val="codePay" :size="size" :unit="unit"
  90. :background="background" :foreground="foreground" :pdground="pdground" :icon="icon"
  91. :iconSize="iconsize" :lv="lv" :onval="onval" :loadMake="loadMake" :usingComponents="true"
  92. @result="qrR" />
  93. </view>
  94. </uv-popup>
  95. </view>
  96. </view>
  97. </template>
  98. <style lang="scss">
  99. .codeBox {
  100. padding: 50rpx 50rpx;
  101. border-radius: 25rpx;
  102. }
  103. .app-bg {
  104. position: absolute;
  105. image {
  106. width: 100vw;
  107. height: 50vw;
  108. }
  109. .body {
  110. position: absolute;
  111. height: 50vw;
  112. width: 100vw;
  113. top: 0;
  114. .count {
  115. font-weight: 500;
  116. font-size: 64rpx;
  117. color: #fff;
  118. }
  119. .label {
  120. margin-top: 4px;
  121. color: #fff;
  122. }
  123. }
  124. }
  125. .app-body {
  126. padding: 0px 20rpx;
  127. position: relative;
  128. top: -100rpx;
  129. .pannel {
  130. background: #fff;
  131. width: calc(100% - 80rpx);
  132. margin-left: 40rpx;
  133. box-shadow: 0px 0px 20px 0px rgba(50, 50, 52, 0.06);
  134. border-radius: 20px;
  135. padding: 40rpx 0;
  136. .item {
  137. width: calc(33.3% - 1px);
  138. image {
  139. width: 62rpx;
  140. height: 62rpx;
  141. }
  142. .text {
  143. font-weight: bold;
  144. font-size: 30rpx;
  145. color: #333333;
  146. margin-top: 4rpx;
  147. }
  148. }
  149. .line {
  150. width: 2rpx;
  151. height: 74rpx;
  152. background: #DCDFE6;
  153. }
  154. }
  155. }
  156. .nav-list {
  157. height: 100rpx;
  158. .item {
  159. margin-right: 50rpx;
  160. .label {
  161. font-weight: bold;
  162. font-size: 30rpx;
  163. color: #5C5C5C;
  164. }
  165. &.active {
  166. .label {
  167. font-weight: bold;
  168. font-size: 36rpx;
  169. color: #2C2C2C;
  170. }
  171. .icon {
  172. width: 36rpx;
  173. height: 14rpx;
  174. margin-top: 4rpx;
  175. }
  176. }
  177. }
  178. .time {
  179. .count {
  180. font-weight: bold;
  181. font-size: 28rpx;
  182. color: #2C2C2C;
  183. }
  184. .label {
  185. font-weight: bold;
  186. font-size: 30rpx;
  187. color: #2C2C2C;
  188. margin-left: 6rpx;
  189. }
  190. .icon {
  191. margin-left: 10rpx;
  192. width: 20rpx;
  193. height: 12rpx;
  194. }
  195. }
  196. }
  197. .detail-list {
  198. background: #FFFFFF;
  199. border-radius: 20rpx;
  200. padding: 40rpx 30rpx;
  201. .top {
  202. margin-bottom: 40rpx;
  203. .label {
  204. font-weight: 500;
  205. font-size: 25rpx;
  206. color: #979797;
  207. }
  208. }
  209. .item {
  210. margin-bottom: 40rpx;
  211. .icon {
  212. width: 84rpx;
  213. height: 84rpx;
  214. }
  215. .info {
  216. width: calc(100% - 280rpx);
  217. margin-left: 16rpx;
  218. .title {
  219. font-weight: bold;
  220. font-size: 28rpx;
  221. color: #333333;
  222. }
  223. .tag {
  224. font-size: 20rpx;
  225. color: #979797;
  226. margin-top: 6rpx;
  227. }
  228. .time {
  229. font-size: 24rpx;
  230. color: #979797;
  231. }
  232. }
  233. .right {
  234. text-align: right;
  235. width: 160rpx;
  236. .money {
  237. font-weight: bold;
  238. font-size: 34rpx;
  239. color: #FF4C4C;
  240. }
  241. .balance {
  242. font-weight: 500;
  243. font-size: 24rpx;
  244. color: #979797;
  245. }
  246. }
  247. }
  248. }
  249. </style>
  250. <script>
  251. import PayDialog from "@/components/ui-pay/payDialog.vue";
  252. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue'
  253. import {
  254. mapState,
  255. mapMutations
  256. } from 'vuex';
  257. export default {
  258. components: {
  259. PayDialog,
  260. tkiQrcode
  261. },
  262. computed: mapState(['user']),
  263. data() {
  264. return {
  265. statusBarHeight: 20,
  266. isFirst: false,
  267. datetime: "",
  268. total: {},
  269. data: [],
  270. page: {
  271. isFirst: false,
  272. isLoad: false,
  273. isFoot: false,
  274. page: 1
  275. },
  276. form: {
  277. dateStr: "",
  278. date: "",
  279. type: "all"
  280. },
  281. navList: [{
  282. "name": "全部",
  283. "code": "all"
  284. },
  285. {
  286. "name": "收入",
  287. "code": "income"
  288. },
  289. {
  290. "name": "支出",
  291. "code": "disburse"
  292. }
  293. ],
  294. codePay: '', //付款码 // 要生成的二维码值
  295. ifShow: true,
  296. size: 400, // 二维码大小
  297. unit: 'upx', // 单位
  298. background: '#fff', // 背景色
  299. foreground: '', // 前景色
  300. pdground: '#FF4C4C', // 角标色
  301. icon: '', // 二维码图标
  302. iconsize: 40, // 二维码图标大小
  303. lv: 3, // 二维码容错级别 , 一般不用设置,默认就行
  304. onval: false, // val值变化时自动重新生成二维码
  305. loadMake: true, // 组件加载完成后自动生成二维码
  306. src: '' // 二维码生成后的图片地址或base64
  307. }
  308. },
  309. onLoad(options) {
  310. this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  311. this.form.dateStr = this.utils.date('Y年m月');
  312. this.form.date = this.utils.date('Y-m');
  313. this.datetime = this.utils.strtotime() * 1000;
  314. },
  315. onShow() {
  316. this.initView();
  317. },
  318. methods: {
  319. ...mapMutations(['checkUserLogin']),
  320. /**
  321. * 加载基础配置
  322. */
  323. initView: function() {
  324. this.totalData();
  325. this.getData(true);
  326. },
  327. fukuan() {
  328. this.$refs['payDialog'].show();
  329. },
  330. payPopupClose() {
  331. this.$refs.payPopup.close()
  332. },
  333. getPassword(val) {
  334. let obj = this
  335. var password = val.password;
  336. obj.request.post("tradeCode", {
  337. payment: password,
  338. }).then(res => {
  339. if (res.code == 200) {
  340. obj.$refs['payDialog'].cleanNum();
  341. obj.$refs['payDialog'].hideFun();
  342. obj.$refs.payPopup.open()
  343. obj.codePay = res.data.rand_code
  344. if (obj.codePay) {
  345. setTimeout(function() {
  346. obj.$refs.qrcode._makeCode()
  347. }, 1000);
  348. }
  349. } else {
  350. obj.$refs['payDialog'].cleanNum();
  351. obj.$refs['payDialog'].hideFun();
  352. uni.showModal({
  353. title: '系统提示',
  354. content: res.msg,
  355. showCancel: false
  356. });
  357. }
  358. })
  359. },
  360. qrR(res) {
  361. this.src = res
  362. },
  363. /**
  364. * 获取数据
  365. */
  366. getData: function(isPull = false) {
  367. if (this.page.isLoad) return;
  368. this.page.isLoad = true;
  369. if (isPull) {
  370. this.page.page = 1;
  371. this.page.isLoad = false;
  372. this.page.isFoot = false;
  373. }
  374. uni.showLoading({
  375. title: '获取数据中..'
  376. });
  377. var post = {};
  378. post.page = this.page.page;
  379. this.request.post("userAward", {
  380. ...this.form,
  381. page: this.page.page
  382. })
  383. .then(res => {
  384. uni.hideLoading();
  385. this.page.isFirst = true;
  386. this.page.isLoad = false;
  387. this.isFirst = true;
  388. if (isPull) {
  389. this.data = res.data.list;
  390. } else {
  391. this.data = this.data.concat(res.data.list);
  392. }
  393. //是否到底
  394. if (res.data.list.length != res.data.pageSize) {
  395. this.page.isFoot = true;
  396. }
  397. })
  398. .catch((res) => {
  399. console.log(res);
  400. uni.hideLoading();
  401. uni.showModal({
  402. title: '系统提示',
  403. content: '加载失败,返回在尝试',
  404. showCancel: false
  405. });
  406. });
  407. },
  408. totalData: function() {
  409. this
  410. .request
  411. .post("userAwardTotal", {
  412. ...this.form
  413. })
  414. .then(res => {
  415. if (res.code == 200) {
  416. this.total = res.data;
  417. }
  418. })
  419. },
  420. loadMoreData: function() {
  421. if (this.page.isFoot || this.page.isLoad) {
  422. return;
  423. }
  424. this.page.page++;
  425. this.getData();
  426. },
  427. tapNav: function(ev) {
  428. this.form.type = ev;
  429. this.getData(true);
  430. },
  431. tapConfirm: function(ev) {
  432. this.form.dateStr = this.utils.date('Y年m月', ev.value / 1000);
  433. this.form.date = this.utils.date('Y-m', ev.value / 1000);
  434. this.isPicker = false;
  435. this.totalData();
  436. this.getData(true);
  437. },
  438. openintegralDate(){
  439. this.$refs.integralDate.open()
  440. },
  441. tapSc: function() {
  442. uni.navigateTo({
  443. url: "/pages/user/detail/integral_sc"
  444. })
  445. },
  446. /**
  447. * 趣豆转账
  448. */
  449. TapZc: function() {
  450. uni.navigateTo({
  451. url: "/pages/user/detail/integral_gift"
  452. })
  453. },
  454. TapZchu() {
  455. uni.navigateTo({
  456. url: "/pages/user/detail/integral_chu"
  457. })
  458. },
  459. },
  460. }
  461. </script>