rechargeCenter.vue 13 KB

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