receiveCoupon.vue 7.7 KB

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