rechargeCenter.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  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">{{headData.userBriefText||'普通用户'}}</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><span style="font-size: 36rpx;">/次</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>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+'my_avatar.png',
  116. tabList:['基础版','专业版','专家版'],
  117. typeCfg:{
  118. 1:'基础版',
  119. 2:'专业版',
  120. 0:'专家版',
  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. if(options.type) this.tindex = Number(options.type)||0
  141. this.getList(this.tindex+1)
  142. }
  143. },
  144. methods:{
  145. getTeamScaleData(){
  146. return new Promise(resolve=>{
  147. this.$api.get('/getListByType/user_brief').then(({data:res})=>{
  148. if(res.code!==0) return this.$showToast(res.msg)
  149. resolve(res.data.map(d=>({name:d.dictLabel,id:d.dictValue})))
  150. })
  151. })
  152. },
  153. async getMyInfo(userId){
  154. const userBrief = await this.getTeamScaleData()
  155. this.$api.get(`/wx/myCount/${userId}`,this.params).then(({data:res})=>{
  156. if(res.code!==0) return this.$showToast(res.msg)
  157. this.headData = res.data;
  158. this.$set(this.headData,'userBriefText',userBrief.find(u=>u.id==this.headData.userBrief).name||'普通用户')
  159. })
  160. },
  161. changeTab(index){
  162. this.tindex = index;
  163. this.pindex = '';
  164. this.otherTimes = 11;
  165. this.price = 0;
  166. this.times = 0;
  167. this.sumPrice = 0;
  168. this.getList(this.tindex+1)
  169. },
  170. getList(type){
  171. this.$api.get(`/core/v2/queproduct/listByType/${type}`).then(({data:res})=>{
  172. if(res.code!==0) return this.$showToast(res.msg)
  173. if(type==1) this.priceList = res.data
  174. else if(type==2) this.priceList2 = res.data
  175. })
  176. },
  177. changePrice(item,index){
  178. this.productId = item.id;
  179. this.pindex = index;
  180. this.frequency = item.frequency;
  181. this.price = item.price;
  182. this.times = item.frequency;
  183. if(this.frequency>10){
  184. this.otherTimes = 11;
  185. this.sumPrice = this.price*this.otherTimes;
  186. } else this.sumPrice = this.price;
  187. },
  188. valueChange(val){
  189. this.otherTimes = val;
  190. this.times = this.otherTimes;
  191. this.sumPrice = this.price*this.otherTimes;
  192. },
  193. confirmBuy(){
  194. this.$api.post('/que/order/createOrder',{
  195. payAmount:this.sumPrice,
  196. productId:this.productId,
  197. totalAmount:this.sumPrice,
  198. totalFrequency:this.times,
  199. type:this.tindex+1,
  200. userId:this.userInfo.id
  201. }).then(({data:res})=>{
  202. if(res.code!==0) return this.$showToast(res.msg)
  203. this.orderNo = res.data;
  204. this.$refs.wxPay.payShow = true;
  205. })
  206. },
  207. toPay(){
  208. this.$api.post('/pay/createOrder',{
  209. orderNo:this.orderNo,
  210. openId:this.userInfo.openId
  211. }).then(({data:res})=>{
  212. if(!res.hasOwnProperty('paySign')) return this.$showToast('支付失败')
  213. this.$refs.wxPay.payShow = false;
  214. this.$wxPay(res).then(result => {
  215. uni.navigateTo({
  216. url:'/pagesPublish/payResult'
  217. })
  218. })
  219. })
  220. }
  221. }
  222. }
  223. </script>
  224. <style scoped lang="scss">
  225. .default_page{
  226. padding: 0;
  227. background: #F9F6EE;
  228. box-sizing: border-box;
  229. .info{
  230. padding: 40rpx 36rpx 37rpx;
  231. &-left{
  232. width: 98rpx;
  233. height: 98rpx;
  234. image{
  235. width: 100%;
  236. height: 100%;
  237. border-radius: 50%;
  238. }
  239. }
  240. &-right{
  241. width: calc(100% - 98rpx);
  242. padding-left: 20rpx;
  243. box-sizing: border-box;
  244. &-name{
  245. .text{
  246. font-family: PingFang-SC, PingFang-SC;
  247. font-weight: bold;
  248. font-size: 36rpx;
  249. color: #795021;
  250. line-height: 32rpx;
  251. }
  252. .version{
  253. width: 160rpx;
  254. height: 40rpx;
  255. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/my_version_bg2.png') no-repeat;
  256. background-size: 100% 100%;
  257. padding-left: 45rpx;
  258. box-sizing: border-box;
  259. font-family: PingFang-SC, PingFang-SC;
  260. font-weight: bold;
  261. font-size: 22rpx;
  262. color: #795021;
  263. line-height: 40rpx;
  264. margin-left: 12rpx;
  265. }
  266. }
  267. &-tip{
  268. font-family: PingFangSC, PingFang SC;
  269. font-weight: 400;
  270. font-size: 26rpx;
  271. color: #667E90;
  272. line-height: 24rpx;
  273. margin-top: 22rpx;
  274. }
  275. }
  276. }
  277. .box{
  278. flex: 1;
  279. overflow-y: auto;
  280. background: #FFFFFF;
  281. border-radius: 36rpx 36rpx 3rpx 3rpx;
  282. padding: 32rpx 30rpx 60rpx;
  283. &-tab{
  284. &-pre{
  285. width: calc(100% / 3);
  286. position: relative;
  287. font-family: PingFang-SC, PingFang-SC;
  288. font-weight: bold;
  289. font-size: 32rpx;
  290. color: #667E90;
  291. line-height: 45rpx;
  292. text-align: center;
  293. &.active{
  294. font-weight: bold;
  295. color: #002846;
  296. &::after{
  297. content: '';
  298. width: 48rpx;
  299. height: 6rpx;
  300. background: #002846;
  301. border-radius: 3rpx;
  302. position: absolute;
  303. left: 50%;
  304. margin-left: -24rpx;
  305. bottom: -15rpx;
  306. }
  307. }
  308. }
  309. }
  310. &-price{
  311. margin-top: 34rpx;
  312. justify-content: space-between;
  313. flex-wrap: wrap;
  314. flex: 1;
  315. overflow-y: auto;
  316. &-pre{
  317. width: calc(50% - 10rpx);
  318. margin-top: 16rpx;
  319. background: #FFFFFF;
  320. border-radius: 24rpx;
  321. border: 2rpx solid #FBEBCB;
  322. position: relative;
  323. &-once{
  324. width: 121rpx;
  325. height: 35rpx;
  326. background: linear-gradient( 270deg, #EF923B 0%, #EA4F27 100%);
  327. border-radius: 10rpx;
  328. font-family: PingFangSC, PingFang SC;
  329. font-weight: 400;
  330. font-size: 24rpx;
  331. color: #FFFFFF;
  332. line-height: 35rpx;
  333. text-align: center;
  334. position: absolute;
  335. left: 0;
  336. top: 0;
  337. }
  338. &-times{
  339. font-family: PingFang-SC, PingFang-SC;
  340. font-weight: bold;
  341. font-size: 30rpx;
  342. color: #002846;
  343. line-height: 30rpx;
  344. text-align: center;
  345. margin-top: 36rpx;
  346. }
  347. &-money{
  348. font-family: D-DINCondensed, D-DINCondensed;
  349. font-weight: bold;
  350. font-size: 53rpx;
  351. color: #002846;
  352. line-height: 87rpx;
  353. margin-top: 20rpx;
  354. span{
  355. font-size: 54rpx;
  356. line-height: 59rpx;
  357. }
  358. }
  359. &-bottom{
  360. width: 100%;
  361. height: 56rpx;
  362. background: #FFF3CB;
  363. border-radius: 0rpx 0rpx 24rpx 24rpx;
  364. font-family: PingFangSC, PingFang SC;
  365. font-weight: 400;
  366. font-size: 24rpx;
  367. color: #95581C;
  368. line-height: 56rpx;
  369. text-align: center;
  370. margin-top: 31rpx;
  371. }
  372. &.active{
  373. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/price_bg.png') no-repeat;
  374. background-size: 100% 100%;
  375. .box-price-pre-times,.box-price-pre-money{
  376. color: #955A1D;
  377. }
  378. .box-price-pre-bottom{
  379. background: url('https://gitee.com/hw_0302/chuang-heng-wechat-images/raw/master/price_bottom2.png') no-repeat;
  380. color: #795021;
  381. }
  382. }
  383. }
  384. }
  385. &-other{
  386. margin-top: 51rpx;
  387. &-left{
  388. font-family: PingFang-SC, PingFang-SC;
  389. font-weight: bold;
  390. font-size: 30rpx;
  391. color: #002846;
  392. line-height: 42rpx;
  393. }
  394. }
  395. &-memo{
  396. margin-top: 48rpx;
  397. &-title{
  398. font-family: PingFang-SC, PingFang-SC;
  399. font-weight: bold;
  400. font-size: 28rpx;
  401. color: #667E90;
  402. line-height: 40rpx;
  403. }
  404. &-p{
  405. font-family: PingFangSC, PingFang SC;
  406. font-weight: 400;
  407. font-size: 24rpx;
  408. color: #95A5B1;
  409. line-height: 40rpx;
  410. margin-top: 16rpx;
  411. }
  412. }
  413. &-btn{
  414. margin-top: 40rpx;
  415. width: 100%;
  416. height: 100rpx;
  417. background: linear-gradient(to right, #242424 0%, #575757 50%);
  418. border-radius: 24rpx;
  419. &-left{
  420. padding-left: 30rpx;
  421. align-items: baseline;
  422. &-text{
  423. font-family: PingFangSC, PingFang SC;
  424. font-weight: 400;
  425. font-size: 24rpx;
  426. color: #FFFFFF;
  427. line-height: 33rpx;
  428. }
  429. &-money{
  430. font-family: D-DINCondensed, D-DINCondensed;
  431. font-weight: bold;
  432. font-size: 36rpx;
  433. color: #FCEED2;
  434. line-height: 52rpx;
  435. margin-left: 9rpx;
  436. align-items: baseline;
  437. span{
  438. font-family: D-DINCondensed, D-DINCondensed;
  439. font-weight: bold;
  440. font-size: 24rpx;
  441. color: #FCEED2;
  442. line-height: 26rpx;
  443. }
  444. }
  445. }
  446. &-right{
  447. width: 365rpx;
  448. height: 100rpx;
  449. background: #11120F;
  450. border-radius: 24rpx;
  451. font-family: PingFang-SC, PingFang-SC;
  452. font-weight: bold;
  453. font-size: 32rpx;
  454. color: #FCEED2;
  455. line-height: 100rpx;
  456. text-align: center;
  457. letter-spacing: 2rpx;
  458. }
  459. }
  460. &-empty{
  461. flex: 1;
  462. image{
  463. width: 370rpx;
  464. height: 284rpx;
  465. }
  466. p{
  467. font-family: PingFangSC, PingFang SC;
  468. font-weight: 400;
  469. font-size: 30rpx;
  470. color: #667E90;
  471. line-height: 40rpx;
  472. text-align: center;
  473. margin-top: 21rpx;
  474. }
  475. text{
  476. font-family: PingFangSC, PingFang SC;
  477. font-weight: 400;
  478. font-size: 36rpx;
  479. color: #667E90;
  480. line-height: 40rpx;
  481. text-align: center;
  482. margin-top: 16rpx;
  483. }
  484. }
  485. }
  486. }
  487. </style>