award.vue 12 KB

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