rechargeCenter.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462
  1. <template>
  2. <view class="default_page adffc" :style="{'min-height':h+'px', 'padding-top':mt+'px'}">
  3. <cus-header title='PERILL评估' bgColor="transparent"></cus-header>
  4. <view class="info adfac">
  5. <view class="info-left">
  6. <image :src="userInfo.headUrl||avatar"></image>
  7. </view>
  8. <view class="info-right">
  9. <view class="info-right-name adfac">
  10. <view class="text">{{userInfo.realName||'游客'}}</view>
  11. <view class="version">{{typeCfg[headData.type]||'基础版'}}</view>
  12. </view>
  13. <view class="info-right-tip">可用次数:基础版{{headData.basicCount||0}}次,专业版{{headData.proCount||0}}次</view>
  14. </view>
  15. </view>
  16. <view class="box adffc">
  17. <view class="box-tab adfacjb">
  18. <view class="box-tab-pre" :class="{'active':tindex===index}"
  19. v-for="(item,index) in tabList" :key="index" @click="changeTab(index)">{{item}}</view>
  20. </view>
  21. <template v-if="tindex===0">
  22. <view class="box-price adf">
  23. <view class="box-price-pre adffcac" :class="{'active':pindex===index}"
  24. v-for="(item,index) in priceList" :key="index" @click="changePrice(item,index)">
  25. <view class="box-price-pre-once" v-if="index===0">限时优惠</view>
  26. <view class="box-price-pre-times">{{item.frequency<11?(item.frequency+'次'):'超过10次'}}</view>
  27. <view class="box-price-pre-money"><span>¥</span>{{item.price}}<span v-if="item.frequency>10">/次</span></view>
  28. <view class="box-price-pre-bottom">
  29. {{item.frequency==1?'首次登录赠送1次':(item.frequency>10?('超过10次,¥'+item.price+'/次'):('¥'+(item.price/item.frequency)+'/次'))}}
  30. </view>
  31. </view>
  32. </view>
  33. <view class="box-other adfacjb" v-if="frequency>10">
  34. <view class="box-other-left">其他次数</view>
  35. <view class="box-other-right">
  36. <cus-number-box :min="min" :number="otherTimes" @valChange="valueChange"></cus-number-box>
  37. </view>
  38. </view>
  39. </template>
  40. <template v-if="tindex===1">
  41. <view class="box-price adf">
  42. <view class="box-price-pre adffcac" :class="{'active':pindex===index}"
  43. v-for="(item,index) in priceList2" :key="index" @click="changePrice(item,index)">
  44. <view class="box-price-pre-times">{{item.frequency<11?(item.frequency+'次'):'超过10次'}}</view>
  45. <view class="box-price-pre-money"><span>¥</span>{{item.price}}<span v-if="item.frequency>10">/次</span></view>
  46. <view class="box-price-pre-bottom">
  47. {{item.frequency==1?'首次登录赠送1次':(item.frequency>10?('超过10次,¥'+item.price+'/次'):('¥'+(item.price/item.frequency)+'/次'))}}
  48. </view>
  49. </view>
  50. </view>
  51. <view class="box-other adfacjb" v-if="frequency>10">
  52. <view class="box-other-left">其他次数</view>
  53. <view class="box-other-right">
  54. <cus-number-box :min="min" :number="otherTimes" @valChange="valueChange"></cus-number-box>
  55. </view>
  56. </view>
  57. </template>
  58. <template v-if="tindex<2">
  59. <view class="box-memo">
  60. <view class="box-memo-title">服务条款说明</view>
  61. <view class="box-memo-p">
  62. 1、未激活的问卷:付费后使用有效期1年,过期将不能使用。<br/>
  63. 2、已进行中问卷:创建者可以设置答题截止时间,修改时间,以支持少数用户延期做问卷。<br/>
  64. 3、其他次数不能低于10次。
  65. </view>
  66. </view>
  67. <view class="box-btn adfacjb">
  68. <view class="box-btn-left adfac">
  69. <view class="box-btn-left-text">实付</view>
  70. <view class="box-btn-left-money adfac"><span>¥</span>{{sumPrice}}<span style="margin-left: 9rpx;">/{{times}}次</span></view>
  71. </view>
  72. <view class="box-btn-right" @click="confirmBuy">确认协议并购买</view>
  73. </view>
  74. </template>
  75. <template v-else>
  76. <view class="box-empty adffcacjc">
  77. <image :src="imgBase+'recharge_empty.png'"></image>
  78. <p>专家版正在开发中</p>
  79. <text>敬请期待</text>
  80. </view>
  81. </template>
  82. </view>
  83. <WechatPay ref="wxPay" @confirmPay="toPay" @cancelPay="cancelPay"></WechatPay>
  84. </view>
  85. </template>
  86. <script>
  87. import CusNumberBox from '@/components/CusNumberBox/index.vue'
  88. import WechatPay from '@/components/wechatPay/index.vue'
  89. export default {
  90. components:{ CusNumberBox, WechatPay },
  91. data(){
  92. return {
  93. userInfo:null,
  94. headData:null,
  95. avatar:this.$imgBase+'avatar.png',
  96. tabList:['基础版','专业版','专家版'],
  97. typeCfg:{
  98. 1:'基础版',
  99. 2:'专业版',
  100. 3:'专家版',
  101. },
  102. tindex:0,
  103. pindex:'',
  104. frequency:0,
  105. priceList:[],
  106. priceList2:[],
  107. min:11,
  108. otherTimes:11,
  109. price:0,
  110. times:0,
  111. sumPrice:0,
  112. productId:'',
  113. orderNo:'',
  114. }
  115. },
  116. onLoad(options) {
  117. if(uni.getStorageSync('userInfo')){
  118. this.userInfo = JSON.parse(uni.getStorageSync('userInfo'));
  119. this.getMyInfo(this.userInfo.id);
  120. this.getList(this.tindex+1)
  121. }
  122. },
  123. methods:{
  124. getMyInfo(userId){
  125. this.$api.get(`/wx/myCount/${userId}`,this.params).then(({data:res})=>{
  126. if(res.code!==0) return this.$showToast(res.msg)
  127. this.headData = res.data;
  128. })
  129. },
  130. changeTab(index){
  131. this.tindex = index;
  132. this.pindex = '';
  133. this.otherTimes = 11;
  134. this.price = 0;
  135. this.times = 0;
  136. this.sumPrice = 0;
  137. this.getList(this.tindex+1)
  138. },
  139. getList(type){
  140. this.$api.get(`/core/v2/queproduct/listByType/${type}`).then(({data:res})=>{
  141. if(res.code!==0) return this.$showToast(res.msg)
  142. if(type==1) this.priceList = res.data
  143. else if(type==2) this.priceList2 = res.data
  144. })
  145. },
  146. changePrice(item,index){
  147. this.productId = item.id;
  148. this.pindex = index;
  149. this.frequency = item.frequency;
  150. this.price = item.price;
  151. this.times = item.frequency;
  152. if(this.frequency>10){
  153. this.otherTimes = 11;
  154. this.sumPrice = this.price*this.otherTimes;
  155. } else this.sumPrice = this.price;
  156. },
  157. valueChange(val){
  158. this.otherTimes = val;
  159. this.times = this.otherTimes;
  160. this.sumPrice = this.price*this.otherTimes;
  161. },
  162. confirmBuy(){
  163. this.$api.post('/que/order/createOrder',{
  164. payAmount:this.sumPrice,
  165. productId:this.productId,
  166. totalAmount:this.sumPrice,
  167. totalFrequency:this.times,
  168. type:this.tindex+1,
  169. userId:this.userInfo.id
  170. }).then(({data:res})=>{
  171. if(res.code!==0) return this.$showToast(res.msg)
  172. this.orderNo = res.data;
  173. this.$refs.wxPay.payShow = true;
  174. })
  175. },
  176. toPay(){
  177. this.$api.post('/pay/createOrder',{
  178. orderNo:this.orderNo,
  179. openId:this.userInfo.openId
  180. }).then(({data:res})=>{
  181. if(!res.hasOwnProperty('paySign')) return this.$showToast('支付失败')
  182. this.$refs.wxPay.payShow = false;
  183. this.$wxPay(res).then(result => {
  184. uni.navigateTo({
  185. url:'/pagesPublish/payResult'
  186. })
  187. })
  188. })
  189. }
  190. }
  191. }
  192. </script>
  193. <style scoped lang="scss">
  194. .default_page{
  195. padding: 0;
  196. background: #F9F6EE;
  197. box-sizing: border-box;
  198. .info{
  199. padding: 40rpx 36rpx 37rpx;
  200. &-left{
  201. width: 98rpx;
  202. height: 98rpx;
  203. image{
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. &-right{
  209. width: calc(100% - 98rpx);
  210. padding-left: 20rpx;
  211. box-sizing: border-box;
  212. &-name{
  213. .text{
  214. font-family: PingFang-SC, PingFang-SC;
  215. font-weight: bold;
  216. font-size: 36rpx;
  217. color: #795021;
  218. line-height: 32rpx;
  219. }
  220. .version{
  221. width: 129rpx;
  222. height: 40rpx;
  223. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/my_version_bg.png') no-repeat;
  224. background-size: 100% 100%;
  225. padding-left: 48rpx;
  226. box-sizing: border-box;
  227. font-family: PingFang-SC, PingFang-SC;
  228. font-weight: bold;
  229. font-size: 22rpx;
  230. color: #795021;
  231. line-height: 40rpx;
  232. margin-left: 12rpx;
  233. }
  234. }
  235. &-tip{
  236. font-family: PingFangSC, PingFang SC;
  237. font-weight: 400;
  238. font-size: 26rpx;
  239. color: #667E90;
  240. line-height: 24rpx;
  241. margin-top: 22rpx;
  242. }
  243. }
  244. }
  245. .box{
  246. flex: 1;
  247. overflow-y: auto;
  248. background: #FFFFFF;
  249. border-radius: 36rpx 36rpx 3rpx 3rpx;
  250. padding: 32rpx 30rpx 60rpx;
  251. &-tab{
  252. &-pre{
  253. width: calc(100% / 3);
  254. position: relative;
  255. font-family: PingFang-SC, PingFang-SC;
  256. font-weight: bold;
  257. font-size: 32rpx;
  258. color: #667E90;
  259. line-height: 45rpx;
  260. text-align: center;
  261. &.active{
  262. font-weight: bold;
  263. color: #002846;
  264. &::after{
  265. content: '';
  266. width: 48rpx;
  267. height: 6rpx;
  268. background: #002846;
  269. border-radius: 3rpx;
  270. position: absolute;
  271. left: 50%;
  272. margin-left: -24rpx;
  273. bottom: -15rpx;
  274. }
  275. }
  276. }
  277. }
  278. &-price{
  279. margin-top: 34rpx;
  280. justify-content: space-between;
  281. flex-wrap: wrap;
  282. &-pre{
  283. width: calc(50% - 10rpx);
  284. margin-top: 16rpx;
  285. background: #FFFFFF;
  286. border-radius: 24rpx;
  287. border: 2rpx solid #FBEBCB;
  288. position: relative;
  289. &-once{
  290. width: 121rpx;
  291. height: 35rpx;
  292. background: linear-gradient( 270deg, #EF923B 0%, #EA4F27 100%);
  293. border-radius: 10rpx;
  294. font-family: PingFangSC, PingFang SC;
  295. font-weight: 400;
  296. font-size: 24rpx;
  297. color: #FFFFFF;
  298. line-height: 35rpx;
  299. text-align: center;
  300. position: absolute;
  301. left: 0;
  302. top: 0;
  303. }
  304. &-times{
  305. font-family: PingFang-SC, PingFang-SC;
  306. font-weight: bold;
  307. font-size: 30rpx;
  308. color: #002846;
  309. line-height: 30rpx;
  310. text-align: center;
  311. margin-top: 36rpx;
  312. }
  313. &-money{
  314. font-family: D-DINCondensed, D-DINCondensed;
  315. font-weight: bold;
  316. font-size: 80rpx;
  317. color: #002846;
  318. line-height: 87rpx;
  319. margin-top: 20rpx;
  320. span{
  321. font-size: 54rpx;
  322. line-height: 59rpx;
  323. }
  324. }
  325. &-bottom{
  326. width: 100%;
  327. height: 56rpx;
  328. background: #FFF3CB;
  329. border-radius: 0rpx 0rpx 24rpx 24rpx;
  330. font-family: PingFangSC, PingFang SC;
  331. font-weight: 400;
  332. font-size: 24rpx;
  333. color: #95581C;
  334. line-height: 56rpx;
  335. text-align: center;
  336. margin-top: 31rpx;
  337. }
  338. &.active{
  339. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/price_bg.png') no-repeat;
  340. background-size: 100% 100%;
  341. .box-price-pre-times,.box-price-pre-money{
  342. color: #955A1D;
  343. }
  344. .box-price-pre-bottom{
  345. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/price_bottom2.png') no-repeat;
  346. color: #795021;
  347. }
  348. }
  349. }
  350. }
  351. &-other{
  352. margin-top: 51rpx;
  353. &-left{
  354. font-family: PingFang-SC, PingFang-SC;
  355. font-weight: bold;
  356. font-size: 30rpx;
  357. color: #002846;
  358. line-height: 42rpx;
  359. }
  360. }
  361. &-memo{
  362. margin-top: 48rpx;
  363. &-title{
  364. font-family: PingFang-SC, PingFang-SC;
  365. font-weight: bold;
  366. font-size: 28rpx;
  367. color: #667E90;
  368. line-height: 40rpx;
  369. }
  370. &-p{
  371. font-family: PingFangSC, PingFang SC;
  372. font-weight: 400;
  373. font-size: 24rpx;
  374. color: #95A5B1;
  375. line-height: 40rpx;
  376. margin-top: 16rpx;
  377. }
  378. }
  379. &-btn{
  380. margin-top: 206rpx;
  381. width: 100%;
  382. height: 100rpx;
  383. background: linear-gradient(to right, #242424 0%, #575757 50%);
  384. border-radius: 24rpx;
  385. &-left{
  386. padding-left: 30rpx;
  387. &-text{
  388. font-family: PingFangSC, PingFang SC;
  389. font-weight: 400;
  390. font-size: 24rpx;
  391. color: #FFFFFF;
  392. line-height: 33rpx;
  393. }
  394. &-money{
  395. font-family: D-DINCondensed, D-DINCondensed;
  396. font-weight: bold;
  397. font-size: 48rpx;
  398. color: #FCEED2;
  399. line-height: 52rpx;
  400. margin-left: 9rpx;
  401. span{
  402. font-family: D-DINCondensed, D-DINCondensed;
  403. font-weight: bold;
  404. font-size: 24rpx;
  405. color: #FCEED2;
  406. line-height: 26rpx;
  407. }
  408. }
  409. }
  410. &-right{
  411. width: 365rpx;
  412. height: 100rpx;
  413. background: #11120F;
  414. border-radius: 24rpx;
  415. font-family: PingFang-SC, PingFang-SC;
  416. font-weight: bold;
  417. font-size: 32rpx;
  418. color: #FCEED2;
  419. line-height: 100rpx;
  420. text-align: center;
  421. letter-spacing: 2rpx;
  422. }
  423. }
  424. &-empty{
  425. flex: 1;
  426. image{
  427. width: 370rpx;
  428. height: 284rpx;
  429. }
  430. p{
  431. font-family: PingFangSC, PingFang SC;
  432. font-weight: 400;
  433. font-size: 30rpx;
  434. color: #667E90;
  435. line-height: 40rpx;
  436. text-align: center;
  437. margin-top: 21rpx;
  438. }
  439. text{
  440. font-family: PingFangSC, PingFang SC;
  441. font-weight: 400;
  442. font-size: 36rpx;
  443. color: #667E90;
  444. line-height: 40rpx;
  445. text-align: center;
  446. margin-top: 16rpx;
  447. }
  448. }
  449. }
  450. }
  451. </style>