index.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358
  1. <template>
  2. <view>
  3. <u-navbar :placeholder="true" bgColor="#fff" :autoBack="true" :border="true" title="我的奖品库"></u-navbar>
  4. <!-- 奖品选择 -->
  5. <view class="prize-state">
  6. <u-tabs @change="changeTab" :scrollable="false" :list="stateArr" lineWidth="40" lineHeight="1"
  7. lineColor="#D70909" :activeStyle="{
  8. color: '#D70909',
  9. transform: 'scale(1)'
  10. }" :inactiveStyle="{
  11. color: '#333',
  12. transform: 'scale(1)'
  13. }" itemStyle="padding-left: 25px; padding-right: 25px; height: 44px;">
  14. </u-tabs>
  15. </view>
  16. <!-- 实物商品 -->
  17. <view class="prize-goods" v-if="state == 0">
  18. <view class="prize-goods-list">
  19. <view class="flex prize-goods-list-item">
  20. <view class="flex checkbox">
  21. <u-checkbox-group>
  22. <u-checkbox :value="checked" shape="circle" :checked="checked" activeColor="#E96737"
  23. @change="changeChecked($event, item)"></u-checkbox>
  24. </u-checkbox-group>
  25. </view>
  26. <view class="flex info">
  27. <image src="../../static/logo.png" mode=""></image>
  28. <view class="flex desc">
  29. <view class="content">Apple iPhone 13 (A2634) 128GB 星光色 支持移动联通电信5G 双卡双待手机</view>
  30. <view class="num">数量:2</view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="flex prize-goods-list-item">
  35. <view class="flex checkbox">
  36. <u-checkbox-group>
  37. <u-checkbox :value="checked" shape="circle" :checked="checked" activeColor="#E96737"
  38. @change="changeChecked($event, item)"></u-checkbox>
  39. </u-checkbox-group>
  40. </view>
  41. <view class="flex info">
  42. <image src="../../static/logo.png" mode=""></image>
  43. <view class="flex desc">
  44. <view class="content">Apple iPhone 13 (A2634) 128GB 星光色 支持移动联通电信5G 双卡双待手机</view>
  45. <view class="num">数量:2</view>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <!-- 卡券 -->
  52. <view class="prize-coupon" v-else>
  53. <view class="prize-coupon-list">
  54. <navigator url="/pages/prize/detail" class="flex prize-coupon-list-item" hover-class="navigator-hover">
  55. <image src="../../static/logo.png" mode=""></image>
  56. <view class="flex info">
  57. <view class="flex desc">
  58. <view class="title">200元代金券</view>
  59. <view class="txt">使用期限:2022.03.02-2022.04.01</view>
  60. <view class="txt">适用范围:星巴克xxx店</view>
  61. </view>
  62. <view class="flex btn">
  63. <view class="amt"><text>¥</text>100</view>
  64. <view class="action">立即使用</view>
  65. </view>
  66. </view>
  67. </navigator>
  68. <navigator url="/pages/prize/detail" class="flex prize-coupon-list-item" hover-class="navigator-hover">
  69. <image src="../../static/logo.png" mode=""></image>
  70. <view class="flex info">
  71. <view class="flex desc">
  72. <view class="title">200元代金券</view>
  73. <view class="txt">使用期限:2022.03.02-2022.04.01</view>
  74. <view class="txt">适用范围:星巴克xxx店</view>
  75. </view>
  76. <view class="flex btn">
  77. <view class="amt"><text>¥</text>100</view>
  78. <view class="action">立即使用</view>
  79. </view>
  80. </view>
  81. </navigator>
  82. </view>
  83. </view>
  84. <view class="prize-action">
  85. <!-- 实物商品提货 -->
  86. <view class="flex prize-action-goods" v-if="state == 0">
  87. <view class="flex checkbox">
  88. <u-checkbox-group>
  89. <u-checkbox :value="checked" shape="circle" :checked="checked" activeColor="#E96737"
  90. @change="changeChecked($event, item)"></u-checkbox>
  91. </u-checkbox-group>
  92. </view>
  93. <view class="btn" @click="toSettlement">立即提货</view>
  94. </view>
  95. <!-- 卡券使用记录 -->
  96. <view class="flex prize-action-coupon" @click="toCoupon" v-else>
  97. <view class="title">卡券使用记录</view>
  98. <u-icon name="arrow-right" size="15" color="#333"></u-icon>
  99. </view>
  100. </view>
  101. </view>
  102. </template>
  103. <script>
  104. import env from '../../config/env.js'
  105. import $http from '@/utils/request.js'
  106. export default {
  107. data() {
  108. return {
  109. stateArr: [{
  110. name: '实物商品'
  111. }, {
  112. name: '卡券',
  113. }],
  114. state: 0,
  115. checked: false,
  116. pageNum: 1,
  117. total: 0,
  118. list: [],
  119. };
  120. },
  121. onLoad() {
  122. this.getList()
  123. },
  124. methods: {
  125. getList() {
  126. let url = this.state == 0 ? '/api/v1/mp/user/mine/prize/list' : '/api/v1/mp/user/mine/coupon/list'
  127. let data = this.state == 0 ? {} : {
  128. status: 1
  129. }
  130. uni.showLoading({
  131. title: '加载中'
  132. });
  133. $http.post(`${ url }?pageNum=${this.pageNum}&pageSize=20`, data).then(res => {
  134. uni.hideLoading();
  135. console.log(res);
  136. return
  137. if (res.code == 0) {
  138. res.rows.forEach(item => {
  139. item.picUrl = env.filePublic + item.picUrl
  140. })
  141. this.total = res.total
  142. this.list = this.list.concat(res.rows)
  143. }
  144. }).catch(() => {
  145. uni.hideLoading();
  146. })
  147. },
  148. pageList() {
  149. this.pageNum = 1
  150. this.list = []
  151. this.getList()
  152. },
  153. // 切换奖品
  154. changeTab(e) {
  155. if (e.index == 0) {
  156. this.state = 0
  157. } else if (e.index == 1) {
  158. this.state = 1
  159. }
  160. this.pageList()
  161. },
  162. changeChecked() {
  163. },
  164. // 查看卡券使用记录
  165. toCoupon() {
  166. uni.navigateTo({
  167. url: '/pages/prize/coupon'
  168. })
  169. },
  170. toSettlement() {
  171. uni.navigateTo({
  172. url: "/pages/order/settlement"
  173. })
  174. },
  175. }
  176. }
  177. </script>
  178. <style lang="scss" scoped>
  179. .prize-state {
  180. position: fixed;
  181. background-color: #FFFFFF;
  182. width: 100%;
  183. padding-bottom: 16rpx;
  184. z-index: 10;
  185. box-shadow: 0 5rpx 5rpx #ececec;
  186. }
  187. .prize-goods {
  188. margin-top: 104rpx;
  189. padding: 40rpx 30rpx 100rpx;
  190. &-list {
  191. &-item {
  192. justify-content: space-between;
  193. padding: 36rpx 16rpx;
  194. background-color: #fff;
  195. border-radius: 10rpx;
  196. margin-bottom: 40rpx;
  197. .checkbox {}
  198. .info {
  199. flex: 1;
  200. justify-content: flex-start;
  201. }
  202. image {
  203. width: 122rpx;
  204. height: 164rpx;
  205. }
  206. .desc {
  207. height: 164rpx;
  208. padding-left: 22rpx;
  209. flex: 1;
  210. flex-direction: column;
  211. align-items: flex-end;
  212. justify-content: space-between;
  213. }
  214. .content {
  215. line-height: 40rpx;
  216. overflow: hidden;
  217. text-overflow: ellipsis;
  218. display: -webkit-box;
  219. -webkit-box-orient: vertical;
  220. -webkit-line-clamp: 2;
  221. }
  222. .num {
  223. color: #8C8C8C;
  224. }
  225. }
  226. &-item:last-child {
  227. margin-bottom: 0;
  228. }
  229. }
  230. }
  231. .prize-coupon {
  232. margin-top: 104rpx;
  233. padding: 40rpx 30rpx 100rpx;
  234. &-list {
  235. &-item {
  236. justify-content: space-between;
  237. background-color: #FFFFFF;
  238. padding: 40rpx 20rpx;
  239. border-radius: 10rpx;
  240. margin-bottom: 40rpx;
  241. image {
  242. width: 94rpx;
  243. height: 132rpx;
  244. }
  245. .info {
  246. justify-content: space-between;
  247. flex: 1;
  248. }
  249. .desc {
  250. height: 132rpx;
  251. flex-direction: column;
  252. justify-content: space-between;
  253. align-items: flex-start;
  254. padding-left: 20rpx;
  255. }
  256. .txt {
  257. font-size: 24rpx;
  258. }
  259. .btn {
  260. flex-direction: column;
  261. }
  262. .amt {
  263. font-size: 48rpx;
  264. font-weight: bold;
  265. line-height: 72rpx;
  266. }
  267. text {
  268. font-size: 24rpx;
  269. }
  270. .action {
  271. width: 124rpx;
  272. height: 40rpx;
  273. line-height: 40rpx;
  274. border-radius: 20rpx;
  275. background-color: rgba(215, 9, 9, 100);
  276. color: rgba(255, 255, 255, 100);
  277. font-size: 24rpx;
  278. text-align: center
  279. }
  280. }
  281. &-item:last-child {
  282. margin-bottom: 0;
  283. }
  284. }
  285. }
  286. .prize-action {
  287. position: fixed;
  288. bottom: var(--window-bottom);
  289. left: 0;
  290. right: 0;
  291. z-index: 10;
  292. box-shadow: 0 -4rpx 10rpx 0 rgba(151, 151, 151, 0.24);
  293. background: #fff;
  294. width: 100%;
  295. // 设置ios刘海屏底部横线安全区域
  296. padding-bottom: constant(safe-area-inset-bottom);
  297. padding-bottom: env(safe-area-inset-bottom);
  298. &-goods {
  299. justify-content: space-between;
  300. padding: 30rpx 40rpx;
  301. .btn {
  302. width: 250rpx;
  303. height: 60rpx;
  304. line-height: 60rpx;
  305. border-radius: 10rpx;
  306. background-color: rgba(235, 112, 9, 100);
  307. color: rgba(255, 255, 255, 100);
  308. font-size: 28rpx;
  309. text-align: center;
  310. }
  311. }
  312. &-coupon {
  313. padding: 30rpx 40rpx;
  314. .title {
  315. margin-right: 20rpx;
  316. line-height: 40rpx;
  317. }
  318. }
  319. }
  320. </style>