redPacket.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. <template>
  2. <view class="content">
  3. <view class="header-img">
  4. <u-image src="/pagesB/static/hbheader.jpg" width="750" height="578"></u-image>
  5. <!-- 滚动区域 -->
  6. <view class="scroll-list" v-if="slist.length">
  7. <scrollBox :list="slist" bgColor="rgba(250, 224, 188, 0.6)"></scrollBox>
  8. </view>
  9. <view class="amount-box">
  10. {{rewardData?rewardData.rewardAmount:'0.00'}}
  11. <text>元</text>
  12. </view>
  13. <view class="view-gz" @click="showModal = true">查看活动规则>></view>
  14. </view>
  15. <view class="list-box">
  16. <view class="codes flex align_center">
  17. <view @click="openImg()">
  18. <u-image :src="hasRedPacket&&hasRedPacket.serviceQrcode" width="160" height="160"></u-image>
  19. </view>
  20. <view>
  21. <view>扫描添加客服微信,领取待发放红包</view>
  22. <view>点击二维码查看大图,长按识别二维码</view>
  23. </view>
  24. </view>
  25. <view class="tabbox">
  26. <view class="tabhead flex align_center justify_between">
  27. <view :class="curTab==0?'active':''" @click="tabChange(0)">所有红包</view>
  28. <view :class="curTab==1?'active':''" @click="tabChange(1)">已发红包</view>
  29. <view :class="curTab==2?'active':''" @click="tabChange(2)">待发红包</view>
  30. </view>
  31. <swiper class="tablist">
  32. <swiper-item class="swiper-item" style="height: 100%;width: 100%;overflow: hidden;">
  33. <scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
  34. <view class="totalBar" v-if="rewardData&&curTab==1&&total">
  35. 共<text>{{total}}</text>个红包,合计<text>{{rewardData.paidAmount||0}}</text>元
  36. </view>
  37. <view class="totalBar" v-if="rewardData&&curTab==2&&total">
  38. 共<text>{{total}}</text>个红包,合计<text>{{rewardData.unPaidAmount||0}}</text>元
  39. </view>
  40. <view class="flex align_center justify_between itemlist" v-for="item in list" :key="item.id">
  41. <view class="flex align_center">
  42. <view class="imgs flex align_center">
  43. <u-icon size="30" color="#fff" name="red-packet"></u-icon>
  44. </view>
  45. <view class="txts">
  46. <view class="txts-name">{{item.orderSourceName}}</view>
  47. <view class="txts-time">{{item.rewardCreateDate}}</view>
  48. </view>
  49. </view>
  50. <view class="amount">+{{item.totalRewardAmount}}</view>
  51. </view>
  52. <view style="padding: 20upx;">
  53. <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
  54. <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
  55. </view>
  56. </scroll-view>
  57. </swiper-item>
  58. </swiper>
  59. </view>
  60. </view>
  61. <!-- 活动规则 -->
  62. <u-popup v-model="showModal" closeable mode="center" border-radius="15" width="600rpx">
  63. <view style="padding: 20rpx;">
  64. <view style="text-align: center;padding: 20rpx 0pt;">活动规则</view>
  65. <view style="font-weight: bold;">【活动时间】</view>
  66. <view style="padding: 10rpx 20rpx;">即日起—2022年12月31日</view>
  67. <view style="font-weight: bold;">【活动内容】</view>
  68. <view style="padding: 10rpx 20rpx;">活动期间,凡是通过店内易码通货架取货和小程序下单的用户,即可获得最高百元现金红包。</view>
  69. <view style="font-weight: bold;">【领取方式】</view>
  70. <view style="padding: 10rpx 20rpx;">在活动页面,扫码或添加客服微信号,发送“姓名+修理厂名称+手机号+提现金额”,客服会在收到信息后1-3个工作日内,以微信红包的形式发放现金红包,您可在“已发放”“待发放”中查看红包金额。</view>
  71. <view style="font-weight: bold;">【注意】</view>
  72. <view style="padding: 10rpx 20rpx;">1.退货或已取消的订单不可领取红包;</view>
  73. <view style="padding: 10rpx 20rpx;">2.红包不可转让或为他人付款;</view>
  74. <view style="padding: 10rpx 20rpx;">3.活动仅限实名认证用户才能参与,因微信账号非实名导致用户无法收到和领取红包的,请联系腾讯客服完成实名认证;</view>
  75. <view style="padding: 10rpx 20rpx;">4.该活动最终解释权归广东易码通数字科技有限公司所有。</view>
  76. <view style="font-weight: bold;">【声明】</view>
  77. <view style="padding: 10rpx 20rpx;">广东易码通数字科技有限公司不会以任何理由向用户所要身份证、银行卡账户和密码等相关信息,请注意保护个人隐私。</view>
  78. </view>
  79. </u-popup>
  80. </view>
  81. </template>
  82. <script>
  83. import scrollBox from '@/components/scrollBox.vue'
  84. import { findUserReward, getRewardOrderList, getRewardRollList } from '@/api/rewardRule.js'
  85. export default {
  86. components: {
  87. scrollBox,
  88. },
  89. data() {
  90. return {
  91. showModal: false,
  92. rewardData: null, // 奖励信息
  93. slist:[],
  94. status: 'loading',
  95. noDataText: '暂无数据',
  96. pageNo: 1,
  97. pageSize: 30,
  98. total: 0,
  99. rewardStatus: ['','paid','un_paid'], //un_paid 未发放,paid 已发放
  100. list: [],
  101. curTab:'2'
  102. }
  103. },
  104. onLoad(){
  105. this.getScrollLog()
  106. this.getUserReward()
  107. this.getEwardOrder()
  108. },
  109. computed: {
  110. hasRedPacket(){
  111. return this.$store.state.vuex_rewardRule
  112. }
  113. },
  114. methods: {
  115. openImg(url){
  116. uni.previewImage({
  117. urls:[this.hasRedPacket&&this.hasRedPacket.serviceQrcode||'']
  118. })
  119. },
  120. // 活动奖励信息
  121. getUserReward(){
  122. findUserReward().then(res => {
  123. this.rewardData = res.data
  124. })
  125. },
  126. tabChange(i){
  127. this.curTab = i
  128. this.list = []
  129. this.total = 0
  130. this.getEwardOrder(1)
  131. this.getUserReward()
  132. },
  133. // 查询列表
  134. getEwardOrder (pageNo) {
  135. let _this = this
  136. if (pageNo) {
  137. this.pageNo = pageNo
  138. }
  139. // 状态条件
  140. let params = {
  141. pageNo: this.pageNo,
  142. pageSize: this.pageSize,
  143. rewardStatus: this.rewardStatus[this.curTab]
  144. }
  145. this.status = "loading"
  146. getRewardOrderList(params).then(res => {
  147. if (res.code == 200 || res.status == 204 || res.status == 200) {
  148. if(_this.pageNo>1){
  149. _this.list = _this.list.concat(res.data.list || [])
  150. }else{
  151. _this.list = res.data.list || []
  152. }
  153. _this.total = res.data.count || 0
  154. } else {
  155. _this.list = []
  156. _this.total = 0
  157. _this.noDataText = res.message
  158. }
  159. _this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
  160. })
  161. },
  162. // scroll-view到底部加载更多
  163. onreachBottom() {
  164. if(this.list.length < this.total){
  165. this.pageNo += 1
  166. this.getEwardOrder()
  167. }else{
  168. this.status = "nomore"
  169. }
  170. },
  171. // 获取上方滚动扫描记录
  172. getScrollLog(){
  173. getRewardRollList({pageNo:1,pageSize:1000}).then(res => {
  174. this.slist = res.data || []
  175. this.slist.map(item => {
  176. item.placeText = item.userName + '刚刚得到了'+item.totalRewardAmount+'元 红包奖励'
  177. })
  178. })
  179. },
  180. }
  181. }
  182. </script>
  183. <style lang="less">
  184. .content{
  185. padding: 0;
  186. background-color: #fae0bc;
  187. .header-img{
  188. position: relative;
  189. color: #fff;
  190. .amount-box{
  191. position: absolute;
  192. width: 100%;
  193. text-align: center;
  194. font-size: 80rpx;
  195. text{
  196. font-size: 40rpx;
  197. }
  198. top: 50%;
  199. color: #f5563d;
  200. }
  201. .view-gz{
  202. position: absolute;
  203. width: 100%;
  204. text-align: center;
  205. bottom: 45rpx;
  206. font-size: 30rpx;
  207. }
  208. .scroll-list{
  209. width:100%;
  210. position: absolute;
  211. left:10rpx;
  212. top:-10rpx;
  213. }
  214. }
  215. .list-box{
  216. padding: 30rpx;
  217. .codes{
  218. margin-bottom: 40rpx;
  219. > view{
  220. &:first-child{
  221. padding: 10rpx;
  222. background-color: #fff;
  223. }
  224. &:last-child{
  225. padding: 0 20rpx;
  226. > view{
  227. padding: 10rpx 0;
  228. font-size: 26rpx;
  229. }
  230. }
  231. }
  232. }
  233. .tabbox{
  234. background-color: #fff5e7;
  235. box-shadow: 0 0 10rpx #e75115;
  236. border-radius: 15rpx;
  237. .tabhead{
  238. border-bottom: 1rpx solid #f0b675;
  239. > view{
  240. width: 30%;
  241. color: #5a4f49;
  242. padding: 20rpx 0;
  243. text-align: center;
  244. }
  245. .active{
  246. color: #e7463c;
  247. border-bottom: 4rpx solid #e7463c;
  248. font-weight: bold;
  249. }
  250. }
  251. .tablist{
  252. height: 70vh;
  253. padding: 20rpx 0;
  254. .itemlist{
  255. border-bottom: 1rpx solid #fff;
  256. padding: 20rpx 30rpx;
  257. .txts-name{
  258. color: #e7463c;
  259. }
  260. .txts-time{
  261. font-size: 24rpx;
  262. color: #666;
  263. margin-top: 10rpx;
  264. }
  265. .amount{
  266. color: #e7463c;
  267. font-weight: bold;
  268. font-size: 32rpx;
  269. }
  270. }
  271. .txts{
  272. padding:0 20rpx;
  273. }
  274. .imgs{
  275. background-color: #fe9790;
  276. border-radius: 100rpx;
  277. padding: 10rpx;
  278. width: 50rpx;
  279. height: 50rpx;
  280. text-align: center;
  281. }
  282. }
  283. .totalBar{
  284. background-color: #fff;
  285. padding: 10rpx 20rpx;
  286. border-radius: 60rpx;
  287. margin: 0 30rpx;
  288. color: #e7463c;
  289. }
  290. }
  291. }
  292. }
  293. </style>