receiveCoupon.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  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. if(res.code==0){
  89. uni.showToast({
  90. title: '领取成功',
  91. icon:'none',
  92. duration: 3000
  93. });
  94. }
  95. this.getCouponCenterList();
  96. })
  97. },
  98. getCouponCenterList(){
  99. var params={}
  100. this.$http('opencoupon/getCouponCenterList', params, 'GET').then(res => {
  101. //uni.hideLoading();
  102. this.list = res.data.list;
  103. this.comment=res.data.comment;
  104. })
  105. },
  106. authorizShowno(){
  107. this.authorizShow=false
  108. },
  109. decryptPhoneNumber: function(e) {
  110. console.log(e);
  111. this.code=e.detail.code
  112. this.wxPhoneLogin()
  113. this.authorizShow=false;
  114. },
  115. wxPhoneLogin(){
  116. var that=this;
  117. this.$http('miniApp2/sys/wxPhoneLogin', {
  118. appId:this.ext.appId,
  119. unionId:this.ext.unionId,
  120. code:this.code,
  121. openId:this.wxOpenData.openid
  122. },'POST').then(res => {
  123. var data = res.data;
  124. if(data.newCustomer){
  125. uni.showModal({
  126. title: '提示',
  127. content: data.newCustomerMsg,
  128. success: function(resTK) {
  129. }
  130. });
  131. var token=res.data.token
  132. data.loginInfo={}
  133. data.loginInfo.token=token
  134. this.$store.commit('mutationswxOpenData', data);
  135. return false;
  136. }
  137. if(data.loginInfo){
  138. this.userInfo=data.loginInfo.openUser;
  139. this.wxOpenData=data.loginInfo;
  140. this.$store.commit('mutationswxOpenData', data)
  141. this.$store.commit('mutationsuserInfo', this.userInfo)
  142. this.getCouponCenterList()
  143. }
  144. })
  145. },
  146. }
  147. }
  148. </script>
  149. <style scoped>
  150. .comment{
  151. padding: 0 24rpx;
  152. color: #FFFFFF;
  153. font-size: 24rpx;
  154. }
  155. .oneClick{
  156. width: 368rpx;height: 82rpx;text-align: center;line-height: 82rpx;
  157. background: url('http://dmsphoto.66km.com.cn/thFiles/D810AED4-98B9-49DB-87E6-42C015BAD016.png');
  158. background-size: 100% 100%;font-weight: 500;
  159. color: #FF0000;font-size: 30rpx;
  160. margin: 0 auto;
  161. margin-top: 80rpx;
  162. }
  163. .content{
  164. min-height: 100vh;
  165. background:#FD5300 ;
  166. }
  167. .top{
  168. height: 272rpx;
  169. background: url('http://dmsphoto.66km.com.cn/thFiles/8CE54BE7-E78E-4BC5-98B7-6320CE691301.png');
  170. background-size: 100% 100%;
  171. }
  172. .line{
  173. background: url('http://dmsphoto.66km.com.cn/thFiles/47158ED0-1F6C-4C6D-840B-D92AADFED33D.png');
  174. background-size: 100% 100%;
  175. margin-top: 20rpx;
  176. height: 200rpx;display: flex;justify-content: space-between;
  177. }
  178. .lineBOx{
  179. padding: 0 24rpx;
  180. }
  181. .lineLeft{
  182. padding-left: 20rpx;padding-top: 24rpx;
  183. }
  184. .lineName{
  185. font-weight: 500;font-size: 30rpx;
  186. color: #333333;
  187. line-height: 42rpx;
  188. }
  189. .moneyBox{
  190. padding-top: 8rpx;display: flex;
  191. }
  192. .moneyBs{
  193. font-weight: 500;font-size: 28rpx;
  194. color: #FF0000;padding-top: 20rpx;
  195. }
  196. .moneyNum{
  197. font-weight: 500;font-size: 48rpx;
  198. color: #FF0000;
  199. }
  200. .mdsky{
  201. font-weight: 400;font-size: 24rpx;
  202. color: #666666;padding-top: 24rpx;padding-left: 2rpx;
  203. }
  204. .endOffsetDays{
  205. font-weight: 400;font-size: 24rpx;
  206. color: #666666;padding-top: 10rpx;
  207. }
  208. .receiveBtn{
  209. width: 150rpx;
  210. height: 56rpx;
  211. background: #FF502D;
  212. border-radius: 36rpx;
  213. text-align: center;
  214. line-height: 56rpx;
  215. font-weight: 500;
  216. color: #FFFFFF;
  217. font-size: 28rpx;
  218. }
  219. .lineRight{
  220. display: flex;
  221. align-items: center;
  222. padding-right: 30rpx;
  223. }
  224. .illustrateBox{
  225. display: flex;padding: 30rpx 0;
  226. justify-content: center;
  227. }
  228. .illustratex{
  229. width: 34rpx;height: 5rpx;background: #FFFFFF;margin-top: 18rpx;
  230. }
  231. .illustrate{
  232. font-size: 28rpx;
  233. font-family: PingFangSC-Medium, PingFang SC;
  234. font-weight: 500;
  235. color: #FFFFFF;padding: 0 16rpx;
  236. line-height: 40rpx
  237. }
  238. .authorizBox{
  239. width: 100vw;
  240. height: 100vh;
  241. background: rgba(0, 0, 0, 0.5);
  242. position: fixed;
  243. top: 0;
  244. left: 0;
  245. }
  246. .authorizCont{
  247. margin-top: 30vh;
  248. width: 564rpx;
  249. height: 408rpx;
  250. background: #FFFFFF;
  251. border-radius: 24rpx;
  252. margin-left: 93rpx;
  253. position: relative;
  254. }
  255. .authorizCloseImg{
  256. width: 62rpx;
  257. height: 62rpx;
  258. }
  259. .sqLogoBox{
  260. width: 180rpx;
  261. height: 180rpx;
  262. background: #FFFFFF;
  263. border-radius: 90rpx;
  264. text-align: center;
  265. position: absolute;
  266. top: -50rpx;
  267. left: 192rpx;
  268. }
  269. .authorizName{
  270. color: #333333;
  271. line-height: 42rpx;
  272. font-size: 30rpx;
  273. text-align: center;
  274. padding-top: 58rpx;
  275. }
  276. .authorizMs{
  277. color: #999999;
  278. line-height: 36rpx;
  279. font-size: 26rpx;
  280. width: 452rpx;
  281. padding-top: 24rpx;
  282. text-align: center;
  283. margin-left: 56rpx;
  284. }
  285. .authorizContbutton{
  286. width: 422rpx;
  287. height: 88rpx;
  288. background: #D53533;
  289. border-radius: 44rpx;
  290. line-height: 88rpx;
  291. text-align: center;
  292. font-size:30rpx;
  293. color: #FFFFFF;
  294. margin-top: 62rpx;
  295. margin-left:71rpx;
  296. }
  297. </style>