Index_Temp.vue 12 KB

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