receiveCoupon.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  1. <template>
  2. <view class="content">
  3. <view class="top"></view>
  4. <view class="lineBOx">
  5. <view class="line" v-for="(item,index) in list">
  6. <view class="lineLeft">
  7. <view class="lineName">{{item.actName}}</view>
  8. <view class="moneyBox">
  9. <span class="moneyBs">¥</span>
  10. <span class="moneyNum">{{item.actMoney}}</span>
  11. <span class="mdsky">{{item.whereMoney!==0?'满'+item.whereMoney+'可用':'无限制'}}</span>
  12. </view>
  13. <view class="endOffsetDays">
  14. <span v-if="item.endOffsetDays">领取后{{item.endOffsetDays}}天有效</span>
  15. <span v-else>{{item.startTime|dateformat}} - {{item.endTime|dateformat}}</span>
  16. </view>
  17. </view>
  18. <view class="lineRight">
  19. <view class="receiveBtn" @click="receive(item.id)">领取</view>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 领取说明 -->
  24. <view class="illustrateBox" v-if="comment">
  25. <view class="illustratex"></view>
  26. <view class="illustrate">领取说明</view>
  27. <view class="illustratex"></view>
  28. </view>
  29. <view class="comment" v-html="comment"> </view>
  30. <!-- 一键领取 -->
  31. <!-- <view class="oneClick">一键领取</view> -->
  32. <!-- 手机号授权 -->
  33. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  34. <view class="authorizCont" @click.stop="">
  35. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  36. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  37. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  38. </view>
  39. <view style="text-align: center;padding-top: 56rpx;">
  40. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data() {
  48. return {
  49. list:[],
  50. comment:'',
  51. authorizShow:false,
  52. userInfo:'',
  53. ext:'',
  54. wxOpenData:'',
  55. }
  56. },
  57. onLoad(opt) {
  58. this.userInfo=this.$store.state.userInfo;
  59. this.ext=this.$common.getExtStoreId();
  60. //scene=2E03F5108B434EFABD70F2D208890209
  61. if(this.userInfo){
  62. this.getCouponCenterList()
  63. }else{
  64. this.$common.automaticlogin().then(val => {
  65. this.userInfo=this.$store.state.userInfo;
  66. this.wxOpenData=this.$store.state.wxOpenData;
  67. this.getCouponCenterList()
  68. if(!this.userInfo){
  69. this.authorizShow=true
  70. }
  71. })
  72. }
  73. },
  74. filters:{
  75. dateformat(val){
  76. return val.slice(0,10)
  77. }
  78. },
  79. methods: {
  80. receive(id){
  81. uni.showLoading({
  82. title: '领取中'
  83. })
  84. this.$http('opencoupon/getCoupons', {
  85. id: id,
  86. }, 'GET').then(res => {
  87. uni.hideLoading();
  88. uni.showToast({
  89. title: '领取成功',
  90. icon:'none',
  91. duration: 3000
  92. });
  93. this.getCouponCenterList();
  94. })
  95. },
  96. getCouponCenterList(){
  97. var params={}
  98. this.$http('opencoupon/getCouponCenterList', params, 'GET').then(res => {
  99. uni.hideLoading();
  100. this.list = res.data.list;
  101. this.comment=res.data.comment;
  102. })
  103. },
  104. authorizShowno(){
  105. this.authorizShow=false
  106. },
  107. decryptPhoneNumber: function(e) {
  108. console.log(e);
  109. this.code=e.detail.code
  110. this.wxPhoneLogin()
  111. this.authorizShow=false;
  112. },
  113. wxPhoneLogin(){
  114. var that=this;
  115. this.$http('miniApp2/sys/wxPhoneLogin', {
  116. appId:this.ext.appId,
  117. unionId:this.ext.unionId,
  118. code:this.code,
  119. openId:this.wxOpenData.openid
  120. },'POST').then(res => {
  121. var data = res.data;
  122. if(data.loginInfo){
  123. this.userInfo=data.loginInfo.openUser;
  124. this.wxOpenData=data.loginInfo;
  125. this.$store.commit('mutationswxOpenData', data)
  126. this.$store.commit('mutationsuserInfo', this.userInfo)
  127. this.getCouponCenterList()
  128. }
  129. })
  130. },
  131. }
  132. }
  133. </script>
  134. <style scoped>
  135. .comment{
  136. padding: 0 24rpx;
  137. color: #FFFFFF;
  138. font-size: 24rpx;
  139. }
  140. .oneClick{
  141. width: 368rpx;height: 82rpx;text-align: center;line-height: 82rpx;
  142. background: url('http://dmsphoto.66km.com.cn/thFiles/D810AED4-98B9-49DB-87E6-42C015BAD016.png');
  143. background-size: 100% 100%;font-weight: 500;
  144. color: #FF0000;font-size: 30rpx;
  145. margin: 0 auto;
  146. margin-top: 80rpx;
  147. }
  148. .content{
  149. min-height: 100vh;
  150. background:#FD5300 ;
  151. }
  152. .top{
  153. height: 272rpx;
  154. background: url('http://dmsphoto.66km.com.cn/thFiles/8CE54BE7-E78E-4BC5-98B7-6320CE691301.png');
  155. background-size: 100% 100%;
  156. }
  157. .line{
  158. background: url('http://dmsphoto.66km.com.cn/thFiles/47158ED0-1F6C-4C6D-840B-D92AADFED33D.png');
  159. background-size: 100% 100%;
  160. margin-top: 20rpx;
  161. height: 200rpx;display: flex;justify-content: space-between;
  162. }
  163. .lineBOx{
  164. padding: 0 24rpx;
  165. }
  166. .lineLeft{
  167. padding-left: 20rpx;padding-top: 24rpx;
  168. }
  169. .lineName{
  170. font-weight: 500;font-size: 30rpx;
  171. color: #333333;
  172. line-height: 42rpx;
  173. }
  174. .moneyBox{
  175. padding-top: 8rpx;display: flex;
  176. }
  177. .moneyBs{
  178. font-weight: 500;font-size: 28rpx;
  179. color: #FF0000;padding-top: 20rpx;
  180. }
  181. .moneyNum{
  182. font-weight: 500;font-size: 48rpx;
  183. color: #FF0000;
  184. }
  185. .mdsky{
  186. font-weight: 400;font-size: 24rpx;
  187. color: #666666;padding-top: 24rpx;padding-left: 2rpx;
  188. }
  189. .endOffsetDays{
  190. font-weight: 400;font-size: 24rpx;
  191. color: #666666;padding-top: 10rpx;
  192. }
  193. .receiveBtn{
  194. width: 150rpx;
  195. height: 56rpx;
  196. background: #FF502D;
  197. border-radius: 36rpx;
  198. text-align: center;
  199. line-height: 56rpx;
  200. font-weight: 500;
  201. color: #FFFFFF;
  202. font-size: 28rpx;
  203. }
  204. .lineRight{
  205. display: flex;
  206. align-items: center;
  207. padding-right: 30rpx;
  208. }
  209. .illustrateBox{
  210. display: flex;padding: 30rpx 0;
  211. justify-content: center;
  212. }
  213. .illustratex{
  214. width: 34rpx;height: 5rpx;background: #FFFFFF;margin-top: 18rpx;
  215. }
  216. .illustrate{
  217. font-size: 28rpx;
  218. font-family: PingFangSC-Medium, PingFang SC;
  219. font-weight: 500;
  220. color: #FFFFFF;padding: 0 16rpx;
  221. line-height: 40rpx
  222. }
  223. .authorizBox{
  224. width: 100vw;
  225. height: 100vh;
  226. background: rgba(0, 0, 0, 0.5);
  227. position: fixed;
  228. top: 0;
  229. left: 0;
  230. }
  231. .authorizCont{
  232. margin-top: 30vh;
  233. width: 564rpx;
  234. height: 408rpx;
  235. background: #FFFFFF;
  236. border-radius: 24rpx;
  237. margin-left: 93rpx;
  238. position: relative;
  239. }
  240. .authorizCloseImg{
  241. width: 62rpx;
  242. height: 62rpx;
  243. }
  244. .sqLogoBox{
  245. width: 180rpx;
  246. height: 180rpx;
  247. background: #FFFFFF;
  248. border-radius: 90rpx;
  249. text-align: center;
  250. position: absolute;
  251. top: -50rpx;
  252. left: 192rpx;
  253. }
  254. .authorizName{
  255. color: #333333;
  256. line-height: 42rpx;
  257. font-size: 30rpx;
  258. text-align: center;
  259. padding-top: 58rpx;
  260. }
  261. .authorizMs{
  262. color: #999999;
  263. line-height: 36rpx;
  264. font-size: 26rpx;
  265. width: 452rpx;
  266. padding-top: 24rpx;
  267. text-align: center;
  268. margin-left: 56rpx;
  269. }
  270. .authorizContbutton{
  271. width: 422rpx;
  272. height: 88rpx;
  273. background: #D53533;
  274. border-radius: 44rpx;
  275. line-height: 88rpx;
  276. text-align: center;
  277. font-size:30rpx;
  278. color: #FFFFFF;
  279. margin-top: 62rpx;
  280. margin-left:71rpx;
  281. }
  282. </style>