exchangeDetail.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <template>
  2. <view class="exchangeDetailBox">
  3. <global-loading />
  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, '.') }}-{{
  48. currentCoupon.endTime.replace(/-/g, '.') }}
  49. </text>
  50. </view>
  51. <view class="flex-items flex-sp-between mar-top-30">
  52. <text class="fs28 font-color-333">兑换须知</text>
  53. <text class="fs28 font-color-999">虚拟权益兑换后不可退换</text>
  54. </view>
  55. </view>
  56. </view>
  57. <view class="cent mar-top-30">
  58. <view class="bg proCondition">
  59. <view class="conditionTit fs32 font-color-333 font-weight-bold">可用商品</view>
  60. <view class="productItemBox mar-top-30">
  61. <view
  62. v-for="item in productList" :key="item.productId" class="productItem"
  63. @click="goodsDateils(item.shopId, item.productId, item.skuId)"
  64. >
  65. <view class="productImg">
  66. <image :src="item.image"></image>
  67. </view>
  68. <view class="productTit mar-top-10 fs28 font-color-333">{{ item.productName }}</view>
  69. <view class="productPrice font-color-C83732 fs40">¥{{ item.price }}</view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. <WxSendCoupon :coupon-list="[ currentCoupon ]" :is-exchange="true" @success="success">
  75. <view class="exchangeBtnBg flex-items">
  76. <view class="exchangeBtn">立即兑换</view>
  77. </view>
  78. </WxSendCoupon>
  79. <!-- 签到弹窗 -->
  80. <TuiModal :show="exchangeTips" :custom="true" :fadein="true">
  81. <view class="Put-box1">
  82. <view class="text-align fs34 fs-bold">
  83. 是否兑换此优惠券
  84. </view>
  85. <view class="flex-display flex-sp-between">
  86. <view class="btn" @click="exchangeTips = false">
  87. 取消
  88. </view>
  89. <view class="btn submit" @click="exchangeFn">
  90. 确定
  91. </view>
  92. </view>
  93. </view>
  94. </TuiModal>
  95. </view>
  96. </template>
  97. <script>
  98. import tuiModal from '@/components/modal/modal'
  99. import NET from '../../utils/request'
  100. import API from '../../config/api'
  101. import WxSendCoupon from '../../components/wx/wxSendCoupon'
  102. export default {
  103. name: 'ExchangeDetail',
  104. components: {
  105. WxSendCoupon,
  106. TuiModal: tuiModal
  107. },
  108. data() {
  109. return {
  110. productList: [],
  111. page: 1,
  112. pageSize: 10,
  113. loadingType: 0,
  114. currentCoupon: {
  115. stockNumber: 0,
  116. credit: 0,
  117. takeCount: 0
  118. },
  119. exchangeTips: false
  120. }
  121. },
  122. onReachBottom() {
  123. if (this.loadingType == 1) {
  124. uni.stopPullDownRefresh()
  125. } else {
  126. this.page = this.page + 1
  127. this.getProductList()
  128. }
  129. },
  130. onLoad(options) {
  131. if (options.data) {
  132. this.currentCoupon = JSON.parse(options.data)
  133. this.getProductList()
  134. }
  135. },
  136. methods: {
  137. getProductList() {
  138. // uni.showLoading({
  139. // title: '加载中...',
  140. // })
  141. NET.request(API.getCouponProducts, {
  142. activityId: this.currentCoupon.couponId,
  143. page: this.page,
  144. pageSize: this.pageSize
  145. }, 'GET').then((res) => {
  146. // uni.hideLoading()
  147. if (res.data.list.length === 0) {
  148. this.loadingType = 1
  149. } else {
  150. this.productList = this.productList.concat(res.data.list)
  151. }
  152. })
  153. .catch((res) => {
  154. // uni.hideLoading()
  155. })
  156. },
  157. receiveCoupon() {
  158. this.exchangeTips = true
  159. },
  160. exchangeFn() {
  161. const paramsData = {
  162. couponId: this.currentCoupon.couponId,
  163. source: 3
  164. }
  165. NET.request(API.exchangeCoupon, paramsData, 'POST').then((res) => {
  166. this.exchangeTips = false
  167. uni.showToast({
  168. title: '兑换成功',
  169. icon: 'success'
  170. })
  171. setTimeout(() => {
  172. uni.navigateTo({
  173. url: '/pages_category_page1/integral/index?tabActive=2'
  174. })
  175. }, 1500)
  176. })
  177. .catch((res) => {
  178. if (res.code !== '200') {
  179. uni.showToast({
  180. title: res.data.message,
  181. icon: 'none'
  182. })
  183. }
  184. })
  185. },
  186. // 商品详情
  187. goodsDateils(shopId, productId, skuId) {
  188. uni.navigateTo({
  189. url: '/pages_category_page1/goodsModule/goodsDetails?shopId=' + shopId + '&productId=' + productId + '&skuId=' + skuId
  190. })
  191. },
  192. success() {
  193. uni.showToast({
  194. title: '兑换成功',
  195. icon: 'success'
  196. })
  197. setTimeout(() => {
  198. uni.navigateTo({
  199. url: '/pages_category_page1/integral/index?tabActive=2'
  200. })
  201. }, 1500)
  202. }
  203. }
  204. }
  205. </script>
  206. <style lang="scss" scoped>
  207. page {
  208. background: #F8F8F8;
  209. }
  210. .exchangeDetailBox {
  211. padding-bottom: 200rpx;
  212. background: #F8F8F8;
  213. .topBg {
  214. background: url("../../static/images/origin/addBankBg.png") no-repeat left top;
  215. background-size: contain;
  216. height: 350rpx;
  217. padding: 40rpx 20rpx 0 20rpx;
  218. .exchangeCoupon {
  219. background: url("../../static/images/origin/exchagneCoupon.png") no-repeat left top;
  220. background-size: contain;
  221. height: 302rpx;
  222. border-radius: 16rpx;
  223. .couponInfo {
  224. color: #FDFED6;
  225. margin-left: 48rpx;
  226. font-weight: 400;
  227. }
  228. }
  229. }
  230. .cent {
  231. padding: 0 20rpx;
  232. .bg {
  233. background: #FFFFFF;
  234. padding: 30rpx;
  235. border-radius: 16rpx;
  236. }
  237. }
  238. .integralInfo {
  239. .integralLeft {
  240. .remaining {
  241. width: auto;
  242. height: 48rpx;
  243. line-height: 48rpx;
  244. padding: 0 15rpx;
  245. text-align: center;
  246. background: rgba(200, 55, 50, 0.16);
  247. border-radius: 24rpx 24rpx 24rpx 0;
  248. font-weight: 300;
  249. }
  250. }
  251. }
  252. .conditionTit {
  253. border-bottom: 2rpx solid #F3F4F5;
  254. height: 92rpx;
  255. line-height: 92rpx;
  256. }
  257. .productItemBox {
  258. display: flex;
  259. flex-wrap: wrap;
  260. justify-content: flex-start;
  261. width: 100%;
  262. .productItem {
  263. height: 420rpx;
  264. flex: 1;
  265. margin: 0 20rpx 40rpx 0;
  266. width: calc((100% - 20rpx) / 2);
  267. min-width: calc((100% - 20rpx) / 2);
  268. max-width: calc((100% - 20rpx) / 2);
  269. &:nth-child(2n) {
  270. margin-right: 0;
  271. }
  272. }
  273. }
  274. .proCondition {
  275. .productItem {
  276. .productImg {
  277. width: 325rpx;
  278. height: 325rpx;
  279. image {
  280. width: 100%;
  281. height: 100%;
  282. }
  283. }
  284. .productTit {
  285. overflow: hidden;
  286. text-overflow: ellipsis;
  287. white-space: nowrap;
  288. }
  289. .productPrice {
  290. margin-top: 15rpx;
  291. }
  292. }
  293. }
  294. .exchangeBtnBg {
  295. width: 750rpx;
  296. height: 164rpx;
  297. background: #FFFFFF;
  298. box-shadow: 0 -1rpx 0rpx rgba(197, 202, 207, 0.5);
  299. padding: 0 20rpx;
  300. position: fixed;
  301. left: 0;
  302. bottom: 0;
  303. .exchangeBtn {
  304. width: 100%;
  305. height: 100rpx;
  306. line-height: 100rpx;
  307. text-align: center;
  308. background: #333333;
  309. border-radius: 50rpx;
  310. color: #FFEBC4;
  311. }
  312. }
  313. .Put-box1 {
  314. .btn {
  315. text-align: center;
  316. margin-top: 40rpx;
  317. border: 1px solid #333333;
  318. height: 80upx;
  319. line-height: 80upx;
  320. width: 100%;
  321. color: #333333;
  322. }
  323. .submit {
  324. background-color: #333333;
  325. color: #FFEBC4;
  326. margin-left: 20rpx;
  327. }
  328. }
  329. }
  330. </style>