多租户商城-商户小程序端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

317 lines
8.9 KiB

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