Index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="container" v-show="isShow">
  3. <image class="bgImg" src="../../static/img/mine/myRewardBG.png"></image>
  4. <view class="headerBox">
  5. <view class="osNavigationBar" :style="{height: statusBarHeight + 'px'}"></view>
  6. <view class="viewTopTitle" :style="{height: navBarHeight + 'px', 'line-height': navBarHeight + 'px'}">
  7. <view class="topTitleBackButton" @tap="onBackTo" :style="{top: (navBarHeight - 20) / 2 + 'px'}">
  8. <image class="topTitleBackButtonImg" src="/static/img/common/back_white.png"></image>
  9. </view>
  10. <text class="topTitleText" style="color: #fff;">我的奖励</text>
  11. </view>
  12. </view>
  13. <view class="contentBox" :style="{height: 'calc(100% - ' + (statusBarHeight + navBarHeight) + 'px)'}">
  14. <view class="numberBox">
  15. <text>¥</text>
  16. <text class="userMoney">{{userMoney}}</text>
  17. <text class="userMoneyTips">历史已领奖励</text>
  18. </view>
  19. <view class="rewardBox">
  20. <view class="rewardHeaderBox">
  21. <view class="tabBox">
  22. <view class="tabItem" :class="tabIndex == '1' ? 'active' : ''" @tap="onChangeState('1')">已领</view>
  23. <view class="tabItem" :class="tabIndex == '0' ? 'active' : ''" @tap="onChangeState('0')">待领取</view>
  24. <view class="tabItem" :class="tabIndex == '2' ? 'active' : ''" @tap="onChangeState('2')">待补领</view>
  25. </view>
  26. </view>
  27. <!-- <view class="titleTips" v-show="tabIndex != '1'">
  28. <image src="../../static/img/mine/starIcon.png" class="tipsIcon"></image>
  29. <text class="tipsText">关注微信公众号“</text>
  30. <text class="linkText" @tap="onGZHTo">自贡随手拍</text>
  31. <text class="tipsText">”</text>
  32. </view> -->
  33. <!-- <view class="rewardDetailBox" :style="{height: (tabIndex == '1' ? 'calc(100% - 120rpx)' : 'calc(100% - 168rpx)')}"> -->
  34. <view class="rewardDetailBox" style="height: calc(100% - 120rpx)">
  35. <view v-if="rewardList.length > 0">
  36. <view class="rewardContentBox" v-for="(item, index) in rewardList">
  37. <view class="rewardTitleBox" @tap="onChangeContentShow(item.Date)">
  38. <view class="rewardTitle">
  39. <text class="rewardTitleDate">{{item.Date}}</text>
  40. <image class="rewardTitleIcon" src="../../static/img/common/selectImg.png"></image>
  41. </view>
  42. <view class="rewardTitleNum">总计 ¥{{item.money}}</view>
  43. </view>
  44. <view class="rewardListBox" v-show="item.showDetail">
  45. <view class="rewardItemBox" v-for="(rewardItem, rewardIndex) in item.list" @tap="onViewTo(rewardItem.FlowID)">
  46. <image class="itemImg" src="/static/img/mine/reward.png"></image>
  47. <view class="itemInfoBox">
  48. <view class="itemTextBox">
  49. <view class="itemTitle">{{rewardItem.Title}}</view>
  50. <view class="itemReason" v-if="tabIndex == '2' && rewardItem.SendReturnMsg">{{rewardItem.SendReturnMsg}}</view>
  51. <view class="itemDate" v-if="tabIndex != '2' || rewardItem.type == '0'">{{rewardItem.SendTime}}</view>
  52. </view>
  53. <view class="itemRedNum">
  54. <text class="itemRedNumText">¥{{rewardItem.Money || 0}}</text>
  55. <text class="itemRedNumBtn" v-if="tabIndex == '2' && rewardItem.type == '0'" @tap.stop="onRedRechargeTo(rewardItem)">补领</text>
  56. </view>
  57. <view class="itemRechargeTipsBox" v-if="tabIndex == '2' && rewardItem.type == '1'">
  58. <text class="itemRechargeDate">{{rewardItem.SendTime}}</text>
  59. <text class="itemRechargeTips">补领申请成功!红包发放中</text>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view class="noneBox" v-else>
  67. <image class="noneImg" src="../../static/img/home/noneImg.png"></image>
  68. <view class="noneTips">暂无数据</view>
  69. </view>
  70. </view>
  71. <!-- <z-paging ref="paging" v-model="rewardList" @query="onGetListData" refresher-update-time-key="list">
  72. <view class="rewardItemBox" v-for="(item, index) in rewardList" @tap="onViewTo(item.FlowID)">
  73. <image class="itemImg" src="/static/img/mine/reward.png"></image>
  74. <view class="itemTextBox">
  75. <view class="itemTitle">{{item.Title}}</view>
  76. <view class="itemDate">{{item.SendTime}}</view>
  77. </view>
  78. <view class="itemRedNum">+{{item.Money || 0}}</view>
  79. </view>
  80. </z-paging> -->
  81. </view>
  82. </view>
  83. <!-- 关注公众号弹窗 -->
  84. <view class="popMask" v-if="isPopShow">
  85. <view class="popContent">
  86. <view class="popTips">长按扫码关注公众号</view>
  87. <image class="popImg" src="../../static/img/mine/qrcode_gyyjgl.jpg" show-menu-by-longpress></image>
  88. <image class="popClose" src="../../static/img/mine/popClose.png" @tap="onGZHCloseTo"></image>
  89. </view>
  90. </view>
  91. </view>
  92. </template>
  93. <script>
  94. var that;
  95. export default {
  96. data() {
  97. return {
  98. isShow: false,
  99. statusBarHeight: 0,
  100. navBarHeight: 0,
  101. userMoney: '0',
  102. tabIndex: '1',
  103. rewardList: [],
  104. isPopShow: false,
  105. }
  106. },
  107. onLoad() {
  108. that = this;
  109. that.statusBarHeight = that.$systemInfo.statusBarHeight;
  110. that.navBarHeight = that.$systemInfo.navBarHeight;
  111. that.onGetData(function() {
  112. that.onGetListData(function() {
  113. that.isShow = true;
  114. });
  115. });
  116. },
  117. methods: {
  118. onGetData(fun) {
  119. that.$admin.req('UserRed', {
  120. WXOpenid: uni.getStorageSync('userInfo').openID
  121. }).then(res => {
  122. if (res[0].data && res[0].data.length > 0) {
  123. that.userMoney = res[0].data[0].SumMoney;
  124. }
  125. typeof fun === 'function' && fun();
  126. })
  127. },
  128. onGetListData(fun) {
  129. that.$admin.reqDirect("GetRedDetailMoon", {
  130. WXOpenid: uni.getStorageSync('userInfo').openID,
  131. Type: that.tabIndex,
  132. }).then(res => {
  133. if (res[0].data && res[0].data.length > 0 && !res[0].data[0].msg) {
  134. let data = res[0].data;
  135. data.forEach((item, index) => {
  136. item.list = JSON.parse(item.list);
  137. item.showDetail = true;
  138. item.list.forEach((rewardItem, rewardIndex) => {
  139. rewardItem.SendTime = that.$util.formatTime(new Date(rewardItem.SendTime));
  140. });
  141. });
  142. that.rewardList = data;
  143. } else if ((res[0].data && res[0].data.length == 0) || (res[0].data[0].msg == '无数据')) {
  144. that.rewardList = [];
  145. } else {
  146. that.$util.msg('网络出错!');
  147. }
  148. typeof fun === 'function' && fun();
  149. })
  150. },
  151. // 切换状态
  152. onChangeState(tabIndex) {
  153. let that = this;
  154. if (that.tabIndex != tabIndex) {
  155. that.tabIndex = tabIndex;
  156. that.onGetListData();
  157. }
  158. },
  159. // 切换内容显示
  160. onChangeContentShow(date) {
  161. let that = this;
  162. for (let index in that.rewardList) {
  163. if (that.rewardList[index].Date == date) {
  164. that.rewardList[index].showDetail = !that.rewardList[index].showDetail
  165. that.$set(that.rewardList, index, that.rewardList[index]);
  166. }
  167. }
  168. },
  169. onViewTo(id) {
  170. if (id && id != '0'){
  171. uni.navigateTo({
  172. url: '/pagesBase/Order/View?type=mine&id=' + encodeURIComponent(id)
  173. })
  174. }
  175. },
  176. // 补领红包
  177. onRedRechargeTo(sendItem) {
  178. let sendID = sendItem.SendID;
  179. let sendType = sendItem.sendType;
  180. that.$admin.reqDirect("GetRedRecharge", {
  181. WXOpenid: uni.getStorageSync('userInfo').openID,
  182. // WXOpenid: 'oyxuU68r3_4WA1VpSHu3Al-i3zEI',
  183. SendID: sendID,
  184. sendType: sendType
  185. }).then(res => {
  186. if (res[0].data && res[0].data.length > 0) {
  187. if (res[0].data[0].state == '1') {
  188. that.$util.msg('补领成功!', function() {
  189. that.onGetListData();
  190. });
  191. } else if (res[0].data[0].state == '0') {
  192. that.$util.msg('补领失败!请稍后再试');
  193. } else if (res[0].data[0].state == '2') {
  194. that.$util.msg('请先关注微信公众号', function() {
  195. that.isPopShow = true;
  196. });
  197. }
  198. } else {
  199. that.$util.msg('补领失败!请稍后再试');
  200. }
  201. typeof fun === 'function' && fun();
  202. })
  203. },
  204. onGZHTo() {
  205. this.isPopShow = true;
  206. },
  207. onGZHCloseTo() {
  208. this.isPopShow = false;
  209. },
  210. // 返回按钮点击事件
  211. onBackTo() {
  212. uni.navigateBack();
  213. },
  214. }
  215. }
  216. </script>
  217. <style lang="less">
  218. .bgImg {
  219. height: 520rpx;
  220. width: 100%;
  221. position: absolute;
  222. top: 0;
  223. left: 0;
  224. }
  225. .contentBox {
  226. overflow-y: auto;
  227. position: relative;
  228. z-index: 9;
  229. }
  230. .numberBox {
  231. text-align: center;
  232. font-size: 32rpx;
  233. color: #fff;
  234. padding: 30rpx 0 40rpx;
  235. }
  236. .userMoney {
  237. font-size: 56rpx;
  238. font-weight: bold;
  239. vertical-align: text-bottom;
  240. margin-left: 4rpx;
  241. }
  242. .userMoneyTips {
  243. display: block;
  244. width: 180rpx;
  245. margin-left: calc(50% - 130rpx);
  246. font-size: 28rpx;
  247. padding: 14rpx 40rpx;
  248. margin-top: 10rpx;
  249. border-radius: 50rpx;
  250. color: #eefcfd;
  251. background-color: #2a74c9;
  252. }
  253. .rewardBox {
  254. background-color: #fff;
  255. border-radius: 50rpx 50rpx 0 0;
  256. height: calc(100% - 190rpx);
  257. }
  258. .rewardDetailBox {
  259. height: calc(100% - 120rpx);
  260. background-color: #fff;
  261. position: relative;
  262. overflow-y: auto;
  263. }
  264. .rewardHeaderBox {
  265. line-height: 0;
  266. background-color: #fff;
  267. border-radius: 50rpx 50rpx 0 0;
  268. margin-bottom: 20rpx;
  269. }
  270. .tabBox {
  271. padding: 0;
  272. line-height: 48rpx;
  273. }
  274. .tabItem {
  275. padding: 40rpx 0 30rpx;
  276. display: inline-block;
  277. width: calc(33.3%);
  278. text-align: center;
  279. color: #333;
  280. font-size: 28rpx;
  281. position: relative;
  282. }
  283. .active {
  284. color: #3e6ffd;
  285. font-weight: bold;
  286. }
  287. .active::after {
  288. content: " ";
  289. width: 100rpx;
  290. height: 4rpx;
  291. background-color: #3e6ffd;
  292. position: absolute;
  293. bottom: 2rpx;
  294. left: calc(50% - 50rpx);
  295. }
  296. .titleTips {
  297. background-color: #fff;
  298. padding: 0rpx 0 20rpx 20rpx;
  299. }
  300. .tipsIcon {
  301. width: 16rpx;
  302. height: 16rpx;
  303. margin: 0 10rpx 4rpx 0;
  304. }
  305. .tipsText {
  306. font-size: 28rpx;
  307. color: #000;
  308. }
  309. .linkText {
  310. font-size: 28rpx;
  311. color: #438cd8;
  312. text-decoration: underline;
  313. }
  314. .rewardContentBox {
  315. position: relative;
  316. height: calc(100% - 120rpx);
  317. background-color: #fff;
  318. }
  319. .rewardTitleBox {
  320. padding: 30rpx 20rpx 30rpx 50rpx;
  321. border-bottom: 2rpx #e2e2e2 solid;
  322. background-color: #f9f9f9;
  323. }
  324. .rewardTitle {
  325. color: #a3a3a3;
  326. font-size: 32rpx;
  327. position: relative;
  328. display: inline-block;
  329. width: calc(100% - 300rpx);
  330. vertical-align: text-bottom;
  331. }
  332. .rewardTitle::before {
  333. content: '';
  334. width: 10rpx;
  335. height: 34rpx;
  336. background-image: linear-gradient(to bottom, #3581d5, #5ca4f6);
  337. position: absolute;
  338. top: 0rpx;
  339. left: -18rpx;
  340. }
  341. .rewardTitleIcon {
  342. width: 30rpx;
  343. height: 30rpx;
  344. vertical-align: bottom;
  345. margin-left: 10rpx;
  346. }
  347. .rewardTitleNum {
  348. display: inline-block;
  349. width: 300rpx;
  350. vertical-align: text-bottom;
  351. color: #000;
  352. font-size: 28rpx;
  353. text-align: right;
  354. }
  355. .rewardListBox {
  356. padding: 0 20rpx;
  357. }
  358. .rewardItemBox {
  359. padding: 46rpx 10rpx 40rpx;
  360. border-bottom: 2rpx #eee solid;
  361. }
  362. .itemImg {
  363. width: 80rpx;
  364. height: 80rpx;
  365. display: inline-block;
  366. vertical-align: middle;
  367. margin-right: 30rpx;
  368. }
  369. .itemInfoBox {
  370. display: inline-block;
  371. vertical-align: middle;
  372. width: calc(100% - 110rpx);
  373. }
  374. .itemTextBox {
  375. display: inline-block;
  376. vertical-align: middle;
  377. width: calc(100% - 190rpx);
  378. }
  379. .itemTitle {
  380. font-size: 30rpx;
  381. color: #000;
  382. width: 100%;
  383. overflow: hidden;
  384. text-overflow: ellipsis;
  385. white-space: nowrap;
  386. padding-bottom: 10rpx;
  387. }
  388. .itemReason {
  389. width: fit-content;
  390. font-size: 24rpx;
  391. padding: 10rpx 24rpx;
  392. background-color: #eee;
  393. color: #000;
  394. border-radius: 50rpx;
  395. margin: 6rpx 0;
  396. margin-left: -2rpx;
  397. }
  398. .itemDate {
  399. padding-top: 10rpx;
  400. font-size: 24rpx;
  401. color: #999;
  402. width: 100%;
  403. }
  404. .itemRedNum {
  405. display: inline-block;
  406. vertical-align: middle;
  407. text-align: right;
  408. width: 190rpx;
  409. }
  410. .itemRedNumText {
  411. display: block;
  412. font-size: 42rpx;
  413. color: #df1617;
  414. }
  415. .itemRedNumBtn {
  416. display: block;
  417. font-size: 28rpx;
  418. color: #fff;
  419. background-color: #3e6ffd;
  420. padding: 20rpx 0;
  421. width: 120rpx;
  422. text-align: center;
  423. margin: 20rpx 0 0 70rpx;
  424. border-radius: 10rpx;
  425. }
  426. .itemRechargeTipsBox {
  427. display: flex;
  428. justify-content: space-between;
  429. padding-top: 10rpx;
  430. font-size: 24rpx;
  431. color: #999;
  432. width: 100%;
  433. }
  434. .itemRechargeDate {}
  435. .itemRechargeTips {
  436. text-align: right;
  437. color: #df1617;
  438. }
  439. /* 自定提示弹窗 */
  440. .popMask {
  441. position: fixed;
  442. left: 0;
  443. top: 0;
  444. right: 0;
  445. bottom: 0;
  446. /* #ifndef APP-NVUE */
  447. display: flex;
  448. /* #endif */
  449. justify-content: center;
  450. align-items: center;
  451. background-color: rgba(0, 0, 0, 0.2);
  452. line-height: 1 !important;
  453. z-index: 99;
  454. }
  455. .popContent {
  456. width: 80%;
  457. line-height: 1 !important;
  458. }
  459. .popTips {
  460. width: 100%;
  461. font-size: 36rpx;
  462. color: #333;
  463. font-weight: bold;
  464. text-align: center;
  465. padding: 30rpx 0;
  466. line-height: 1 !important;
  467. background-color: #fff;
  468. border-radius: 30rpx 30rpx 0 0;
  469. }
  470. .popImg {
  471. width: 100%;
  472. height: 600rpx;
  473. border-radius: 0 0 30rpx 30rpx;
  474. }
  475. .popClose {
  476. margin-top: 30rpx;
  477. width: 80rpx;
  478. height: 80rpx;
  479. margin-left: calc(50% - 40rpx);
  480. }
  481. .noneBox {
  482. background-color: #fff;
  483. border-radius: 50rpx 50rpx 0 0;
  484. padding: 50rpx 20rpx;
  485. text-align: center;
  486. }
  487. .noneImg {
  488. width: 200rpx;
  489. height: 200rpx;
  490. }
  491. .noneTips {
  492. font-size: 26rpx;
  493. color: #aaaaaa;
  494. text-align: center;
  495. margin-top: 10rpx;
  496. }
  497. // .rewardItemBox {
  498. // padding: 46rpx 10rpx 40rpx;
  499. // border-bottom: 2rpx #eee solid;
  500. // }
  501. // .itemImg {
  502. // width: 80rpx;
  503. // height: 80rpx;
  504. // display: inline-block;
  505. // vertical-align: middle;
  506. // margin-right: 30rpx;
  507. // }
  508. // .itemTextBox {
  509. // display: inline-block;
  510. // vertical-align: middle;
  511. // width: calc(100% - 300rpx);
  512. // }
  513. // .itemTitle {
  514. // font-size: 30rpx;
  515. // color: #000;
  516. // width: 100%;
  517. // overflow: hidden;
  518. // text-overflow: ellipsis;
  519. // white-space: nowrap;
  520. // margin-bottom: 20rpx;
  521. // }
  522. // .itemDate {
  523. // font-size: 24rpx;
  524. // color: #999;
  525. // width: 100%;
  526. // }
  527. // .itemRedNum {
  528. // display: inline-block;
  529. // vertical-align: middle;
  530. // text-align: right;
  531. // width: 190rpx;
  532. // font-size: 42rpx;
  533. // color: #df1617;
  534. // }
  535. </style>