index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="exchangeDetailBox">
  3. <JHeader title="积分兑换" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view class="topBg">
  5. <view class="exchangeCoupon flex-items">
  6. <view class="couponInfo">
  7. <view class="font-color-FFF fs60">
  8. {{ currentCoupon.couponType === 1
  9. ? `满${currentCoupon.fullMoney}减${currentCoupon.reduceMoney}元` : `打${currentCoupon.reduceMoney}折` }}
  10. </view>
  11. <view class="font-color-FFF mar-top-30 fs48">{{ currentCoupon.couponType === 1 ? '满减券' : '折扣券' }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="cent mar-top-30">
  16. <view class="bg integralInfo flex-display flex-sp-between">
  17. <view class="integralLeft flex-display">
  18. <view>
  19. <view class="fs48 font-color-C83732 flex-items">
  20. <view class="mar-right-20">{{ currentCoupon.credit || 0 }}积分</view>
  21. <view class="remaining fs24 font-color-C83732">
  22. 还剩{{ currentCoupon.stockNumber || 0 }}件
  23. </view>
  24. </view>
  25. <view v-if="currentCoupon.fullMoney !== 0" class="fs32 font-color-333">
  26. 满{{ currentCoupon.fullMoney }}{{
  27. currentCoupon.couponType === 1 ? '减' : '打' }}{{ currentCoupon.reduceMoney }}{{ currentCoupon.couponType ===
  28. 1 ? '元' : '折' }}券
  29. </view>
  30. <view v-if="currentCoupon.fullMoney === 0" class="fs32 font-color-333">
  31. 无门槛{{ currentCoupon.couponType === 1
  32. ? '减' : '打' }}{{ currentCoupon.reduceMoney }}{{ currentCoupon.couponType === 1 ? '元' : '折' }}券
  33. </view>
  34. </view>
  35. </view>
  36. <view class="integralRight flex-column-plus flex-end">
  37. <view class="remaining fs28 font-color-999">已兑{{ currentCoupon.takeCount || 0 }}</view>
  38. </view>
  39. </view>
  40. </view>
  41. <view class="cent mar-top-30">
  42. <view class="bg exchangeCondition">
  43. <view class="conditionTit fs32 font-color-333 font-weight-bold">兑换条件</view>
  44. <view class="flex-items flex-sp-between mar-top-30">
  45. <text class="fs28 font-color-333">有效期</text>
  46. <text class="fs28 font-color-999">
  47. {{ currentCoupon.startTime.replace(/-/g, '.') }}-{{ currentCoupon.endTime.replace(/-/g, '.') }}
  48. </text>
  49. </view>
  50. <view class="flex-items flex-sp-between mar-top-30">
  51. <text class="fs28 font-color-333">兑换须知</text>
  52. <text class="fs28 font-color-999">虚拟权益兑换后不可退换</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="cent mar-top-30">
  57. <view class="bg proCondition">
  58. <view class="conditionTit fs32 font-color-333 font-weight-bold">可用商品</view>
  59. <view class="productItemBox mar-top-30">
  60. <view
  61. v-for="item in productList" :key="item.productId" class="productItem"
  62. @click="goodsDateils(item.shopId, item.productId, item.skuId)"
  63. >
  64. <view class="productImg">
  65. <image :src="common.seamingImgUrl(item.image)"></image>
  66. </view>
  67. <view class="productTit mar-top-10 fs28 font-color-333">{{ item.productName }}</view>
  68. <view class="productPrice font-color-C83732 fs40">¥{{ item.price }}</view>
  69. </view>
  70. <view style="padding-bottom: 45upx;">
  71. <LoadingMore
  72. :status="!isEmpty && !productList.length
  73. ? 'loading' : !isEmpty && productList.length && (productList.length >= productListTotal) ? 'no-more' : ''"
  74. >
  75. </LoadingMore>
  76. <tui-no-data v-if="isEmpty" :fixed="false" style="margin-top: 60upx;">暂无数据</tui-no-data>
  77. </view>
  78. </view>
  79. </view>
  80. </view>
  81. <ATFWXSendCoupon :coupon-list="[ currentCoupon ]" :is-exchange="true" @success="success">
  82. <view class="exchangeBtnBg flex-items">
  83. <view class="exchangeBtn">立即兑换</view>
  84. </view>
  85. </ATFWXSendCoupon>
  86. <!-- 签到弹窗 -->
  87. <tui-modal :show="exchangeTips" :custom="true" :fadein="true">
  88. <view class="Put-box1">
  89. <view class="text-align fs34 fs-bold">
  90. 是否兑换此优惠券
  91. </view>
  92. <view class="flex-display flex-sp-between">
  93. <view class="btn" @click="exchangeTips = false">
  94. 取消
  95. </view>
  96. <view class="btn submit" @click="exchangeFn">
  97. 确定
  98. </view>
  99. </view>
  100. </view>
  101. </tui-modal>
  102. </view>
  103. </template>
  104. <script>
  105. import { getCouponProductsApi, updateCreditExchangeCouponApi } from '../../../api/anotherTFInterface'
  106. export default {
  107. name: 'ExchangeDetail',
  108. data() {
  109. return {
  110. productList: [],
  111. productListTotal: 0,
  112. page: 1,
  113. pageSize: 10,
  114. isEmpty: false,
  115. currentCoupon: {
  116. startTime: '',
  117. endTime: '',
  118. stockNumber: 0,
  119. credit: 0,
  120. takeCount: 0
  121. },
  122. exchangeTips: false
  123. }
  124. },
  125. onReachBottom() {
  126. if (this.productList.length < this.productListTotal) {
  127. ++this.page
  128. this.getProductList(true)
  129. }
  130. },
  131. onLoad(options) {
  132. if (options.data) {
  133. this.currentCoupon = JSON.parse(options.data)
  134. this.getProductList()
  135. }
  136. },
  137. methods: {
  138. getProductList(isLoadmore) {
  139. uni.showLoading()
  140. getCouponProductsApi({
  141. activityId: this.currentCoupon.couponId,
  142. page: this.page,
  143. pageSize: this.pageSize
  144. })
  145. .then((res) => {
  146. this.productListTotal = res.data.total
  147. if (isLoadmore) {
  148. this.productList.push(...res.data.list)
  149. } else {
  150. this.productList = res.data.list
  151. }
  152. this.isEmpty = this.productList.length === 0
  153. uni.hideLoading()
  154. })
  155. .catch(() => {
  156. uni.hideLoading()
  157. })
  158. },
  159. receiveCoupon() {
  160. this.exchangeTips = true
  161. },
  162. exchangeFn() {
  163. const paramsData = {
  164. couponId: this.currentCoupon.couponId,
  165. source: 3
  166. }
  167. updateCreditExchangeCouponApi(paramsData).then((res) => {
  168. this.exchangeTips = false
  169. uni.showToast({
  170. title: '兑换成功',
  171. icon: 'success'
  172. })
  173. setTimeout(() => {
  174. uni.navigateTo({
  175. url: '/another-tf/another-serve/integral/index?tabActive=2'
  176. })
  177. }, 1500)
  178. })
  179. },
  180. // 商品详情
  181. goodsDateils(shopId, productId, skuId) {
  182. uni.navigateTo({
  183. url: '/another-tf/another-serve/goodsDetails/index?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  184. })
  185. },
  186. success() {
  187. uni.showToast({
  188. title: '兑换成功',
  189. icon: 'success'
  190. })
  191. setTimeout(() => {
  192. uni.navigateTo({
  193. url: '/another-tf/another-serve/integral/index?tabActive=2'
  194. })
  195. }, 1500)
  196. }
  197. }
  198. }
  199. </script>
  200. <style lang="less" scoped>
  201. .exchangeDetailBox {
  202. padding-bottom: 200rpx;
  203. background-color: #F8F8F8;
  204. min-height: 100vh;
  205. box-sizing: border-box;
  206. .topBg {
  207. background-color: #333333;
  208. background-size: contain;
  209. height: 350rpx;
  210. padding: 40rpx 20rpx 0 20rpx;
  211. .exchangeCoupon {
  212. background-color: #f1b53d;
  213. background-size: contain;
  214. height: 302rpx;
  215. border-radius: 16rpx;
  216. .couponInfo {
  217. color: #FDFED6;
  218. margin-left: 48rpx;
  219. font-weight: 400;
  220. }
  221. }
  222. }
  223. .cent {
  224. padding: 0 20rpx;
  225. .bg {
  226. background: #FFFFFF;
  227. padding: 30rpx;
  228. border-radius: 16rpx;
  229. }
  230. }
  231. .integralInfo {
  232. .integralLeft {
  233. .remaining {
  234. width: auto;
  235. height: 48rpx;
  236. line-height: 48rpx;
  237. padding: 0 15rpx;
  238. text-align: center;
  239. background: rgba(200, 55, 50, 0.16);
  240. border-radius: 24rpx 24rpx 24rpx 0;
  241. font-weight: 300;
  242. }
  243. }
  244. }
  245. .conditionTit {
  246. border-bottom: 2rpx solid #F3F4F5;
  247. height: 92rpx;
  248. line-height: 92rpx;
  249. }
  250. .productItemBox {
  251. display: flex;
  252. flex-wrap: wrap;
  253. justify-content: flex-start;
  254. width: 100%;
  255. .productItem {
  256. height: 420rpx;
  257. flex: 1;
  258. margin: 0 20rpx 40rpx 0;
  259. width: calc((100% - 20rpx) / 2);
  260. min-width: calc((100% - 20rpx) / 2);
  261. max-width: calc((100% - 20rpx) / 2);
  262. &:nth-child(2n) {
  263. margin-right: 0;
  264. }
  265. }
  266. }
  267. .proCondition {
  268. .productItem {
  269. .productImg {
  270. width: 325rpx;
  271. height: 325rpx;
  272. image {
  273. width: 100%;
  274. height: 100%;
  275. }
  276. }
  277. .productTit {
  278. overflow: hidden;
  279. text-overflow: ellipsis;
  280. white-space: nowrap;
  281. }
  282. .productPrice {
  283. margin-top: 15rpx;
  284. }
  285. }
  286. }
  287. .exchangeBtnBg {
  288. width: 750upx;
  289. height: 164rpx;
  290. background: #FFFFFF;
  291. box-shadow: 0 -1rpx 0rpx rgba(197, 202, 207, 0.5);
  292. padding: 0 20rpx;
  293. position: fixed;
  294. left: 0;
  295. bottom: 0;
  296. box-sizing: border-box;
  297. .exchangeBtn {
  298. width: 100%;
  299. height: 100rpx;
  300. line-height: 100rpx;
  301. text-align: center;
  302. background: #333333;
  303. border-radius: 50rpx;
  304. color: #FFEBC4;
  305. }
  306. }
  307. .Put-box1 {
  308. .btn {
  309. text-align: center;
  310. margin-top: 40rpx;
  311. border: 1px solid #333333;
  312. height: 80upx;
  313. line-height: 80upx;
  314. width: 100%;
  315. color: #333333;
  316. }
  317. .submit {
  318. background-color: #333333;
  319. color: #FFEBC4;
  320. margin-left: 20rpx;
  321. }
  322. }
  323. }
  324. </style>