Index_Temp.vue 11 KB

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