hykt.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  1. <template>
  2. <view>
  3. <view class="status_bar"></view>
  4. <u-navbar :is-back="false" :border-bottom="false" :background="background">
  5. <view style="width: 100%;padding: 0 10rpx;">
  6. <view class="flztoa inlbhhe ">
  7. <navigator class="indihh" url="/pages/index/index" open-type="redirect" hover-class="none">
  8. <text>最新</text>
  9. </navigator>
  10. <view class="indihh">
  11. <text style="font-size: 44rpx;color: #374B6E;">会员</text>
  12. <view
  13. style="width: 26rpx;height: 4rpx;background: #374B6E;border-radius: 4rpx;margin-top: 10rpx;">
  14. </view>
  15. </view>
  16. <navigator class="indihh" url="/pages/index/zylx" open-type="redirect" hover-class="none">
  17. <text>治愈练习</text>
  18. </navigator>
  19. <navigator class="indihh" url="/pages/index/hd" open-type="redirect" hover-class="none">
  20. <text>活动</text>
  21. </navigator>
  22. </view>
  23. </view>
  24. </u-navbar>
  25. <view class="hyinnr" style="overflow: hidden;">
  26. <image src="/static/my/my01.png"
  27. style="width: 100%; height: 103%; position: absolute; left: 0; top: 0rpx; z-index: -1;" mode=""></image>
  28. <view class="hyinnrks">
  29. <view style="margin: 60rpx 40rpx 36rpx 40rpx;">
  30. <image src="/static/my/my02.png" style="width: 227.14rpx;height: 56rpx;" mode=""></image>
  31. </view>
  32. <view class="hyintxt">
  33. <text>开通会员尽享三大权益</text>
  34. </view>
  35. <view class="hyinrq">
  36. <text>到期:{{info.vip.over_time}}</text>
  37. </view>
  38. </view>
  39. </view>
  40. <scroll-view scroll-x="true" class="card_list">
  41. <view :class="card_checked == index ? 'card_a card_item':'card_item'" v-for="(item, index) in card_list"
  42. @click="changeCard(index)">
  43. <view class="card_dis_title" v-if="item.dis">{{item.dis.title}}</view>
  44. <view class="card_dis_title" v-else>暂无折扣</view>
  45. <view class="card_title">{{item.title}}</view>
  46. <view class="card_price" v-if="item.dis"><text class="card_price_icon">¥</text>{{item.dis.price}}</view>
  47. <view class="card_price" v-else><text class="card_price_icon">¥</text>{{item.price}}</view>
  48. <view class="card_origin" v-if="item.dis"><text class="del_line">¥{{item.price}}</text>特惠</view>
  49. <view class="card_origin" v-else><text class="del_line"></text>特惠</view>
  50. </view>
  51. </scroll-view>
  52. <view class="myxmkstt">
  53. <view class="myhbtui">
  54. <view class="myshutt"></view>
  55. <text>专属权益</text>
  56. </view>
  57. <view class="flztoa" style="margin: 0 66rpx; margin-top: 20rpx;">
  58. <view class="myiodde">
  59. <image src="/static/my/myb01.png" style="width: 80rpx;height: 80rpx;margin-bottom: 6rpx;" mode="">
  60. </image>
  61. <text>会员价</text>
  62. </view>
  63. <view class="myiodde">
  64. <image src="/static/my/myb02.png" style="width: 80rpx;height: 80rpx;margin-bottom: 6rpx;" mode="">
  65. </image>
  66. <text>体检理疗</text>
  67. </view>
  68. <view class="myiodde">
  69. <image src="/static/my/myb03.png" style="width: 80rpx;height: 80rpx;margin-bottom: 6rpx;" mode="">
  70. </image>
  71. <text>更多优惠</text>
  72. </view>
  73. </view>
  74. </view>
  75. <view class="myxmkstt">
  76. <view class="myhbtui">
  77. <view class="myshutt"></view>
  78. <text>会员规则</text>
  79. </view>
  80. <view class="mytxtjs">
  81. <rich-text :nodes="info.vip_set.agreement"></rich-text>
  82. </view>
  83. </view>
  84. <view class="btn" @click="pay" v-if="is_vip == 0">
  85. 开通会员/¥{{card_list[card_checked].dis ? card_list[card_checked].dis.price : card_list[card_checked].price}}
  86. </view>
  87. <view style="height: 130rpx;"></view>
  88. <view class="dibuboot">
  89. <navigator class="dibubootlb" url="../index/index" open-type="redirect" hover-class="none">
  90. <image src="/static/dibu/bob1.png" style="width: 48rpx;height: 48rpx;"></image>
  91. <text style="color: #374B6E">首页</text>
  92. </navigator>
  93. <!-- <navigator class="dibubootlb" url="../lecturer/wdzx" open-type="redirect" hover-class="none">
  94. <image src="/static/dibu/boa2.png" style="width: 48rpx;height: 48rpx;"></image>
  95. <text>咨询</text>
  96. </navigator>
  97. <navigator class="dibubootlb" url="../index/jiehuo" open-type="redirect" hover-class="none">
  98. <image src="/static/dibu/boa3.png" style="width: 48rpx;height: 48rpx;"></image>
  99. <text>解惑</text>
  100. </navigator> -->
  101. <navigator class="dibubootlb" url="../lecturer/my" open-type="redirect" hover-class="none">
  102. <image src="/static/dibu/boa4.png" style="width: 48rpx;height: 48rpx;"></image>
  103. <text>我的</text>
  104. </navigator>
  105. </view>
  106. </view>
  107. </template>
  108. <style>
  109. page {
  110. background: #FAFAFA;
  111. }
  112. </style>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. background: {
  118. backgroundColor: '#ffffff',
  119. },
  120. info: {},
  121. is_vip: 0,
  122. deviceType: 'wxapp',
  123. scrollTop: 0,
  124. old: {
  125. scrollTop: 0
  126. },
  127. card_list: [],
  128. card_checked: 0,
  129. card: {},
  130. }
  131. },
  132. onLoad() {
  133. // #ifdef APP-PLUS
  134. this.deviceType = 'wxh5'
  135. // #endif
  136. // #ifdef MP-WEIXIN
  137. this.deviceType = 'wxapp'
  138. // #endif
  139. this.getvipinfo();
  140. this.is_vip = uni.getStorageSync('is_vip');
  141. },
  142. methods: {
  143. changeCard(index) {
  144. this.card_checked = index;
  145. this.card = this.card_list[index];
  146. },
  147. getvipinfo() {
  148. let user_id = uni.getStorageSync('id');
  149. this.$post({
  150. data: {
  151. do: 'Vip',
  152. data: {
  153. user_id: user_id,
  154. pw: '375'
  155. }
  156. }
  157. }).then(res => {
  158. if (res.data.is_vip == 1) {
  159. uni.setStorageSync('is_vip', 1);
  160. this.is_vip = uni.getStorageSync('is_vip');
  161. }
  162. this.info = res.data,
  163. this.card_list = this.info.vip_card;
  164. this.card = this.info.vip_card[0];
  165. })
  166. },
  167. pay() {
  168. let that = this;
  169. console.log(that.card, 'accc');
  170. let user_id = uni.getStorageSync('id');
  171. that.$post({
  172. data: {
  173. do: 'VipOrder',
  174. data: {
  175. card_id: that.card.id,
  176. cdkey: '',
  177. user_id: user_id,
  178. pw: '375',
  179. },
  180. deviceType: this.deviceType
  181. }
  182. }).then(res => {
  183. that.wechatpay(res.data);
  184. })
  185. },
  186. wechatpay(pay) {
  187. var that = this
  188. // #ifdef APP-PLUS
  189. uni.requestPayment({
  190. "provider": "wxpay",
  191. orderInfo: pay.orderinfo, //微信、支付宝订单数据 【注意微信的订单信息,键值应该全部是小写,不能采用驼峰命名】
  192. success: function(res) {
  193. console.log('success:' + JSON.stringify(res));
  194. uni.showToast({
  195. title: '支付成功'
  196. })
  197. that.is_vip = 1;
  198. uni.setStorageSync('is_vip', 1)
  199. that.getvipinfo();
  200. },
  201. fail: function(err) {
  202. console.log(pay.orderinfo, 'eeeeeeeeeeeeeeeee')
  203. console.log('fail:' + JSON.stringify(err));
  204. uni.showToast({
  205. title: '支付失败',
  206. icon: 'error'
  207. })
  208. }
  209. });
  210. // #endif
  211. // #ifdef MP-WEIXIN
  212. uni.requestPayment({
  213. provider: 'wxpay',
  214. timeStamp: pay.timeStamp,
  215. nonceStr: pay.nonceStr,
  216. package: pay.package,
  217. signType: 'MD5',
  218. paySign: pay.paySign,
  219. success() {
  220. uni.showToast({
  221. title: '支付成功'
  222. })
  223. that.is_vip = 1;
  224. uni.setStorageSync('is_vip', 1)
  225. that.getvipinfo();
  226. },
  227. fail(res) {
  228. console.log(res)
  229. uni.showToast({
  230. title: '支付失败',
  231. icon: 'error'
  232. })
  233. }
  234. })
  235. // #endif
  236. }
  237. }
  238. }
  239. </script>
  240. <style lang="scss" scoped>
  241. .status_bar {
  242. height: var(--status-bar-height);
  243. width: 100%;
  244. }
  245. .btn {
  246. width: 524upx;
  247. height: 100upx;
  248. background: #F8DAB9;
  249. font-size: 36upx;
  250. display: flex;
  251. align-items: center;
  252. justify-content: center;
  253. border-radius: 100upx;
  254. margin: 50upx auto;
  255. }
  256. .card_list {
  257. white-space: nowrap;
  258. width: 100%;
  259. }
  260. .card_item {
  261. width: 200rpx;
  262. height: 260rpx;
  263. border-radius: 20rpx;
  264. margin: 0 10rpx;
  265. display: inline-block;
  266. border: 6rpx solid #f1f1f1;
  267. }
  268. .card_item:last-child {
  269. margin-right: 42rpx;
  270. }
  271. .card_item:first-child {
  272. margin-left: 42rpx;
  273. }
  274. .card_dis_title {
  275. line-height: 50rpx;
  276. height: 50rpx;
  277. background-color: #ffcb7d;
  278. text-align: center;
  279. font-weight: 700;
  280. border-radius: 15rpx 15rpx 0 0;
  281. color: #fff;
  282. width: 100%;
  283. }
  284. .card_title {
  285. line-height: 50rpx;
  286. height: 50rpx;
  287. text-align: center;
  288. }
  289. .card_price {
  290. line-height: 88rpx;
  291. text-align: center;
  292. height: 88rpx;
  293. font-weight: 700;
  294. font-size: 50rpx;
  295. }
  296. .card_price_icon {
  297. font-size: 25rpx;
  298. margin-right: 5rpx;
  299. }
  300. .card_origin {
  301. text-align: center;
  302. }
  303. .del_line {
  304. text-decoration: line-through;
  305. margin-right: 5rpx;
  306. }
  307. .card_a {
  308. border: 6rpx solid #ffcb7d;
  309. }
  310. </style>