Index.vue 14 KB

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