redPacket.vue 8.6 KB

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