rechargeCenter.vue 14 KB

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