coupon-share.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  1. <template>
  2. <view class="container clearfix">
  3. <view class="container-list">
  4. <view class="coupon-list">
  5. <view class="list-cell-le">
  6. <view class="list-cell-tags">
  7. <text class="tags">{{ coupon.couponType | TypeFormat }}</text>
  8. </view>
  9. <view class="list-cell-price">
  10. {{ coupon.couponAmount }}元满{{ coupon.touchPrice }}可用
  11. </view>
  12. <view class="list-cell-texts">
  13. <text v-if="coupon.couponType == 0">
  14. {{ coupon.productType && coupon.productType == 1 ? '全商城商品通用' : '仅可购买指定商品' }}
  15. </text>
  16. <text v-if="coupon.couponType == 1">
  17. {{ coupon.categoryType == 1 ? '仅限购买产品类商品' : '仅限购买仪器类商品' }}
  18. </text>
  19. <text v-if="coupon.couponType == 3">仅限购买店铺【{{ coupon.shopName }}】的商品</text>
  20. <text v-if="coupon.couponType == 4 || coupon.couponType == 2">全商城商品通用</text>
  21. </view>
  22. <view class="list-cell-time">{{ coupon.startDate }} - {{ coupon.endDate }}</view>
  23. </view>
  24. <view class="list-cell-ri">
  25. <view class="coupon-minMoney">售价</view>
  26. <view class="coupon-maxMoney">
  27. <text class="small">¥</text>
  28. {{ coupon.couponAmount }}
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="container-button">
  34. <view class="button" @click="MiniWxPayFor">¥10000购买</view>
  35. </view>
  36. </view>
  37. </template>
  38. <script>
  39. import { mapState,mapMutations} from 'vuex'
  40. import authorize from '@/common/config/authorize.js'
  41. export default {
  42. data() {
  43. return {
  44. StaticUrl:this.$Static,
  45. isIphoneX:this.$store.state.isIphoneX,
  46. coupon:{
  47. couponId:257,
  48. couponAmount:10000.00,
  49. touchPrice:20000.00,
  50. startDate:"2022.02.10",
  51. endDate:"2022.04.10",
  52. couponType:0,
  53. userId:null,
  54. shopId:null,
  55. productType:1,
  56. categoryType:null,
  57. shopName:null,
  58. useStatus:null,
  59. couponBtnType:0,
  60. usePeriod:null
  61. },
  62. coupinList:[],
  63. clubId:0 ,// 机构Id
  64. couponId:0,//优惠券Id
  65. payAmount:100 //支付金额
  66. }
  67. },
  68. onLoad(option) {
  69. this.clubId = option.clubId
  70. this.couponId = option.couponId
  71. console.log('机构Id',this.clubId)
  72. console.log('价值优惠券Id',this.couponId)
  73. },
  74. filters: {
  75. TypeFormat(value) {
  76. switch (value) {
  77. case 0:
  78. return '活动券'
  79. break
  80. case 1:
  81. return '品类券'
  82. break
  83. case 2:
  84. return '用户专享券'
  85. break
  86. case 3:
  87. return '店铺券'
  88. break
  89. case 4:
  90. return '新用户券'
  91. break
  92. }
  93. }
  94. },
  95. computed: {
  96. ...mapState(['hasLogin','userInfo','identity','isActivity'])
  97. },
  98. methods: {
  99. async initGetStotage() {
  100. const userInfo = await this.$api.getStorage()
  101. const clubInfo = await this.$api.getComStorage('orderUserInfo')
  102. this.shareClubId = clubInfo.clubId ? clubInfo.clubId : 0
  103. },
  104. async MiniWxPayFor(){
  105. const wechatcode = await authorize.getCode('weixin')
  106. const params ={
  107. payAmount:this.$reg.formatAccMul(this.payAmount,100),
  108. payWay:'WEIXIN',
  109. code:wechatcode,
  110. orderId:18399
  111. }
  112. this.PayService.WeChatMiniWxPay(params).then(response =>{
  113. // 友盟埋点收集微信支付
  114. if(process.env.NODE_ENV != 'development'){
  115. this.$uma.trackEvent('Um_Event_ConfirmWechatPay', {
  116. Um_Key_PageName: '微信支付',
  117. Um_Key_SourcePage: '线上支付',
  118. Um_Key_PayName:`${this.buttonText}`,
  119. Um_Key_PayOrderID:`${this.orderId}`
  120. })
  121. }
  122. let PayInfo = JSON.parse(response.data.data.payInfo)
  123. this.WxRequestPayment(PayInfo)
  124. }).catch(error =>{
  125. this.$util.msg(error.msg,2000)
  126. })
  127. },
  128. WxRequestPayment(data){
  129. let self = this
  130. wx.requestPayment({
  131. 'timeStamp': data.timeStamp,
  132. 'nonceStr': data.nonceStr,
  133. 'package': data.package,
  134. 'signType': data.signType,
  135. 'paySign': data.paySign,
  136. 'success':function(res){
  137. wx.reLaunch({url: '/pages/tabBar/user/user'})
  138. },
  139. 'fail':function(res){
  140. self.$util.msg('用户取消支付~')
  141. },
  142. 'complete':function(res){
  143. }
  144. })
  145. },
  146. navigator(url){
  147. this.$api.navigateTo(url)
  148. },
  149. },
  150. onPullDownRefresh() {
  151. setTimeout(() => {
  152. this.QueryCouponList()
  153. uni.stopPullDownRefresh()
  154. }, 200)
  155. },
  156. onReachBottom() {
  157. if(this.hasNextPage){
  158. this.loadding = true
  159. this.pullUpOn = true
  160. this.getOnReachBottomData()
  161. }
  162. },
  163. onShow(){
  164. this.initGetStotage()
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. page{
  170. background-color: #F7F7F7;
  171. }
  172. .container{
  173. width: 100%;
  174. height: auto;
  175. }
  176. .container-list {
  177. box-sizing: border-box;
  178. padding:24rpx;
  179. .empty-container-image {
  180. width: 260rpx;
  181. height: 260rpx;
  182. margin-top: -300rpx;
  183. }
  184. .toIndexPage {
  185. bottom: 390rpx;
  186. }
  187. .coupon-list{
  188. width: 100%;
  189. height: 200rpx;
  190. box-sizing: border-box;
  191. background: url(https://static.caimei365.com/app/img/icon/icon-coupon-buy@2x.png);
  192. background-size: cover;
  193. position: relative;
  194. .list-cell-le{
  195. width: 502rpx;
  196. height: 100%;
  197. box-sizing: border-box;
  198. padding: 23rpx 32rpx;
  199. float: left;
  200. .list-cell-tags{
  201. width: 100%;
  202. height: 32rpx;
  203. margin-bottom: 7rpx;
  204. .tags{
  205. display: inline-block;
  206. padding: 0 10rpx;
  207. height: 32rpx;
  208. line-height: 32rpx;
  209. background: linear-gradient(270deg, #F94B4B 0%, #FEB673 100%);
  210. color: #FFFFFF;
  211. font-size: $font-size-22;
  212. border-radius: 8rpx;
  213. text-align: center;
  214. float: left;
  215. }
  216. }
  217. .list-cell-price{
  218. width: 100%;
  219. height: 45rpx;
  220. line-height: 45rpx;
  221. font-size: $font-size-32;
  222. color: #333333;
  223. text-align: left;
  224. margin-top: 10rpx;
  225. font-weight: bold;
  226. }
  227. .list-cell-texts{
  228. width: 100%;
  229. height: auto;
  230. line-height:40rpx;
  231. text-overflow:ellipsis;
  232. display: -webkit-box;
  233. word-break: break-all;
  234. -webkit-box-orient: vertical;
  235. -webkit-line-clamp: 1;
  236. overflow: hidden;
  237. font-size: 26rpx;
  238. color: #333333;
  239. }
  240. .list-cell-time{
  241. width: 100%;
  242. height: 32rpx;
  243. line-height: 32rpx;
  244. text-align: left;
  245. font-size: $font-size-20;
  246. color: #999999;
  247. }
  248. }
  249. .list-cell-ri{
  250. width: 200rpx;
  251. height: 100%;
  252. box-sizing: border-box;
  253. padding: 58rpx 0 0 0;
  254. float: right;
  255. .coupon-maxMoney{
  256. width: 100%;
  257. height: 78rpx;
  258. line-height: 78rpx;
  259. font-size: 40rpx;
  260. color: #F94B4B;
  261. text-align: center;
  262. .small{
  263. font-size: $font-size-26;
  264. }
  265. }
  266. .coupon-minMoney{
  267. width: 100%;
  268. height: 33rpx;
  269. line-height: 33rpx;
  270. font-size: $font-size-26;
  271. color: #F94B4B;
  272. text-align: center;
  273. }
  274. }
  275. }
  276. }
  277. .container-button{
  278. width: 100%;
  279. height: 90rpx;
  280. margin-top: 190rpx;
  281. .button{
  282. width: 600rpx;
  283. height: 90rpx;
  284. text-align: center;
  285. background: $btn-confirm;
  286. line-height: 90rpx;
  287. font-size: $font-size-30;
  288. color: #FFFFFF;
  289. margin: 0 auto;
  290. border-radius: 45rpx;
  291. }
  292. }
  293. </style>