耀实惠小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

322 lines
6.9 KiB

  1. <template>
  2. <view class="pages">
  3. <view class="top flex align-center">
  4. <image :src="userInfo.headUrl" mode=""></image>
  5. <text class="font-30 font-weight-bold">{{userInfo.nickName}}</text>
  6. </view>
  7. <view class="card">
  8. <view class="title">
  9. <image :src="img_url+'member/min.png'" mode=""></image>
  10. <!-- <text>会员购物 更省钱更实惠</text> -->
  11. <text>等级越高实惠更多</text>
  12. </view>
  13. <view class="select">
  14. <view class="item" v-for="(item,index) in select_list" :key="index">
  15. <view :class="index== status? 'item select ': 'item'" @click="changeStatus(index)">
  16. <text class="title">{{item.name}}</text>
  17. <text class="price" v-if="index==0">{{item.money}}/{{'计算'}}</text>
  18. <text class="price" v-else>{{item.money}}/</text>
  19. <view class="old_money">
  20. <text>原价</text>
  21. <text class="through">¥{{item.oldMoney}}</text>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <!-- 权益 -->
  27. <view class="equities">
  28. <view class="title">
  29. <image :src="img_url+'member/max.png'" mode=""></image>
  30. <text>{{select_list[status].title}}</text>
  31. </view>
  32. <rich-text :nodes="select_list[status].concert"></rich-text>
  33. <!-- <view class="item" v-for="(item,index) in select_list[status].equitiesList" :key="index">
  34. <image :src="img_url+'member/dot.png'" mode=""></image>
  35. <text>{{item}}</text>
  36. </view> -->
  37. </view>
  38. <!-- 按钮 -->
  39. <view class="btn">
  40. <view class="left">
  41. <text class="icons"></text>
  42. <text class="num">{{select_list[status].money}}</text>
  43. <text class="info_text">开通即享特权</text>
  44. </view>
  45. <text class="right" @click="toDredge">立即开通</text>
  46. </view>
  47. </view>
  48. </view>
  49. </template>
  50. <script>
  51. import config_img from "@/utils/js/config.js"
  52. export default {
  53. data() {
  54. return {
  55. status: 0,
  56. img_url: config_img.img_url,
  57. select_list: [],
  58. userInfo:{}
  59. }
  60. },
  61. onLoad() {
  62. this.getVipList();
  63. this.userInfo = uni.getStorageSync("__user_info");
  64. console.log(this.userInfo)
  65. },
  66. methods: {
  67. changeStatus(index) {
  68. this.status = index
  69. },
  70. getVipList() {
  71. uni.showLoading();
  72. this.$api('getVipList').then(res => {
  73. let { code, result, message } = res;
  74. uni.hideLoading();
  75. if(code == 200) {
  76. console.log(result)
  77. this.select_list = result.records
  78. }else {
  79. this.$Toast(message);
  80. }
  81. }).catch(err => {
  82. uni.hideLoading();
  83. this.$Toast(err.message);
  84. })
  85. },
  86. // 获取用户信息
  87. getUserInfo () {
  88. uni.showLoading();
  89. this.$api('getUserInfo')
  90. .then(res => {
  91. let { code, result, message } = res
  92. uni.hideLoading();
  93. if (code === 200) {
  94. const userInfo = {...result.userInfo,...result.account}
  95. this.$storage.setStorage("__user_info",userInfo)
  96. console.log(userInfo)
  97. } else {
  98. this.$Toast(message)
  99. }
  100. })
  101. .catch(err => {
  102. this.$Toast(err.message)
  103. uni.hideLoading();
  104. })
  105. },
  106. toDredge() {
  107. const id = this.select_list[this.status].id
  108. if(this.userInfo.cardType == 0){
  109. uni.navigateTo({
  110. url: "./dredge/index?id="+id
  111. })
  112. }else {
  113. this.$api('vipPay',{id}).then(res =>{
  114. const { code, result, message } = res
  115. console.log(res)
  116. if (code == 200) {
  117. uni.requestPayment({
  118. provider: 'wxpay',
  119. timeStamp: result.timeStamp,
  120. nonceStr: result.nonceStr,
  121. package: result.packageValue,
  122. signType: result.signType,
  123. paySign: result.paySign,
  124. success: res => {
  125. this.$Toast('支付成功');
  126. // 刷新用户数据
  127. this.getUserInfo();
  128. setTimeout(() => {
  129. this.$tools.navigateTo({
  130. url: './upgrades_renewals/index'
  131. })
  132. },1500)
  133. },
  134. fail:error=>{
  135. this.$Toast('取消支付')
  136. }
  137. })
  138. } else{
  139. this.$Toast(message)
  140. }
  141. })
  142. }
  143. },
  144. }
  145. }
  146. </script>
  147. <style lang="scss" scoped>
  148. .pages{
  149. position: relative;
  150. .top{
  151. background-color: #000;
  152. height: 270rpx;
  153. display: flex;
  154. align-items: flex-start;
  155. border-bottom-left-radius: 70rpx;
  156. border-bottom-right-radius: 70rpx;
  157. image{
  158. width: 120rpx;
  159. height: 120rpx;
  160. border-radius: 50%;
  161. margin-top: 31rpx;
  162. margin-left: 45rpx;
  163. }
  164. text{
  165. color: #fff;
  166. padding-top: 65rpx;
  167. padding-left: 17rpx;
  168. font-size: 30rpx;
  169. font-weight: bold;
  170. }
  171. }
  172. .card{
  173. position: absolute;
  174. top: 175rpx;
  175. left: 10rpx;
  176. width: 729rpx;
  177. border-top-left-radius: 70rpx;
  178. border-top-right-radius: 70rpx;
  179. background-color: #fff;
  180. display: flex;
  181. flex-direction: column;
  182. align-items: center;
  183. .title{
  184. margin-top: 23rpx;
  185. margin-bottom: 30rpx;
  186. image{
  187. width: 45rpx;
  188. height: 30rpx;
  189. }
  190. text{
  191. font-size: 32rpx;
  192. font-weight: bold;
  193. color: #000;
  194. }
  195. }
  196. .select{
  197. width: 605rpx;
  198. margin: 0 auto;
  199. display: flex;
  200. flex-wrap: wrap;
  201. justify-content: space-between;
  202. .item{
  203. background-color: #F5F5F5;
  204. margin-top: 33rpx;
  205. color: #000000;
  206. width: 285rpx;
  207. display: flex;
  208. flex-direction: column;
  209. align-items: center;
  210. border-radius: 15rpx;
  211. .title{
  212. margin-top: 37rpx;
  213. margin-bottom: 0;
  214. font-size: 35rpx;
  215. font-weight: bold;
  216. }
  217. .price{
  218. font-size: 30rpx;
  219. margin-top: 20rpx;
  220. margin-bottom: 22rpx;
  221. }
  222. .old_money{
  223. margin-bottom: 35rpx;
  224. font-size: 16rpx;
  225. .through{
  226. text-decoration: line-through;
  227. }
  228. }
  229. }
  230. .select{
  231. background-color: #FFEDCF;
  232. margin: 0;
  233. padding-top: 32rpx;
  234. color: #8B5B13;
  235. }
  236. }
  237. .equities{
  238. margin-top: 57rpx;
  239. margin-left: 65rpx;
  240. width: 596rpx;
  241. .title{
  242. margin-top: 0;
  243. margin-bottom: 0;
  244. image{
  245. width: 61rpx;
  246. height: 41rpx;
  247. }
  248. text{
  249. font-size: 32rpx;
  250. font-weight: bold;
  251. color: #000;
  252. }
  253. }
  254. .item{
  255. margin-top: 18rpx;
  256. display: flex;
  257. justify-content: flex-start;
  258. image{
  259. width: 21rpx;
  260. height: 25rpx;
  261. margin-top: 8rpx;
  262. margin-right: 17rpx;
  263. }
  264. text{
  265. display: inline-block;
  266. width: 557rpx;
  267. font-size: 28rpx;
  268. }
  269. }
  270. }
  271. .btn{
  272. width: 642rpx;
  273. height: 93rpx;
  274. border-radius: 47rpx;
  275. overflow: hidden;
  276. margin-top: 140rpx;
  277. margin-bottom: 47rpx;
  278. display: flex;
  279. .left{
  280. width: 309rpx;
  281. background-color: #302F2D;
  282. display: flex;
  283. justify-content: center;
  284. align-items: center;
  285. .icons{
  286. font-size: 24rpx;
  287. padding-top: 10rpx;
  288. color: #FFDA85;
  289. }
  290. .num{
  291. font-size: 43rpx;
  292. color: #FFDA85;
  293. }
  294. .info_text{
  295. font-size: 14rpx;
  296. padding-left: 10rpx;
  297. padding-top: 20rpx;
  298. color: #C2B09A;
  299. }
  300. }
  301. .right{
  302. flex: 1;
  303. display: flex;
  304. justify-content: center;
  305. align-items: center;
  306. font-size: 28rpx;
  307. font-weight: bold;
  308. color: #6F4920;
  309. background-color: #F6D27F;
  310. }
  311. }
  312. }
  313. }
  314. </style>