index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578
  1. <template>
  2. <view class="page">
  3. <!-- 钱包 -->
  4. <view class="recharge-me">
  5. <view class="bg-img">
  6. <!-- <image src="../../static/recharge/u1709.jpg" mode=""></image> -->
  7. </view>
  8. <view class="wallet-content">
  9. <view class="h-balance-wrap">
  10. <view class="h-balance">
  11. <view class="recharge-balance">
  12. <view class="h-nav-img">
  13. <image src="../../static/transaction/u1.png" mode=""></image>
  14. </view>
  15. <view class="name">储值余额</view>
  16. <view class="balance-value">¥
  17. <text v-if="userInfo.rechargeBalance">{{userInfo.rechargeBalance}}</text>
  18. <text v-else>0</text>
  19. </view>
  20. </view>
  21. <view class="recharge-balance">
  22. <view class="h-nav-img">
  23. <image src="../../static/transaction/u3.png" mode=""></image>
  24. </view>
  25. <view class="name">赠送余额</view>
  26. <view class="balance-value">¥
  27. <text v-if="userInfo.rewardBalance" class="">{{userInfo.rewardBalance}}</text>
  28. <text v-else>0</text>
  29. </view>
  30. </view>
  31. <view class="recharge-balance">
  32. <view class="h-nav-img">
  33. <image src="../../static/transaction/u4.png" mode=""></image>
  34. </view>
  35. <view class="name">赠送优惠券</view>
  36. <view class="balance-value">
  37. <text v-if="userInfo.coupon" >{{userInfo.coupon}}</text>
  38. <text v-else>0</text>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="horizontal-dashed-line"></view>
  43. <view class="btn">
  44. <view @click="gotoTransactionRecords()" class="item-btn">
  45. <text>交易记录</text>>
  46. </view>
  47. <view class="dashed-line" ></view>
  48. <view @click="gotoTransactionOrderRecords()" class="item-btn">
  49. <text>储值订单</text>>
  50. </view>
  51. </view>
  52. </view>
  53. <view class="skill-sequence-panel-content-wrapper">
  54. <!--左边虚化-->
  55. <!-- <view class="hide-content-box hide-content-box-left"></view> -->
  56. <!--右边虚化-->
  57. <!-- <view class="hide-content-box hide-content-box-right"></view> -->
  58. <scroll-view scroll-x="true" class="kite-classify-scroll">
  59. <view @click="selectActiveRecharge(item,index)" class="kite-classify-cell shadow" v-for="(item, index) in rechargeList" :key="index">
  60. <view v-if="currentTab === index" class="h-bg-img">
  61. <image src="../../static/transaction/u2.png" mode=""></image>
  62. </view>
  63. <view v-else class="h-bg-img">
  64. <image src="../../static/recharge/dianka.png" mode=""></image>
  65. </view>
  66. <view class="content">
  67. <view class="money">
  68. ¥<text class="v">{{item.reachPrice}}</text>
  69. </view>
  70. <view class="desc">
  71. <text>{{item.name}} </text>
  72. <!-- <text>充¥{{item.reachPrice}}赚送¥{{item.discountsPrice}}</text> -->
  73. </view>
  74. </view>
  75. </view>
  76. </scroll-view>
  77. </view>
  78. <!-- 选择充值金额 -->
  79. <!-- <view class="recharge-content-wrap">
  80. <view v-for="(item,index) in rechargeList"
  81. @click="selectActiveRecharge(item,index)" class="recharge-content">
  82. <view v-if="currentTab === index" class="h-bg-img">
  83. <image src="../../static/transaction/u2.png" mode=""></image>
  84. </view>
  85. <view v-else class="h-bg-img">
  86. <image src="../../static/recharge/dianka.png" mode=""></image>
  87. </view>
  88. <view class="content">
  89. <view class="money">
  90. ¥<text class="v">{{item.reachPrice}}</text>
  91. </view>
  92. <view class="desc">
  93. <text>{{item.name}} </text>
  94. <text>充¥{{item.reachPrice}}赚送¥{{item.discountsPrice}}</text>
  95. </view>
  96. </view>
  97. </view>
  98. </view> -->
  99. <!-- 自定义充值金额 -->
  100. <!-- <view class="h-custom">
  101. <view class="h-icon">
  102. <u-icon name="rmb" color="#333" size="22"></u-icon>
  103. </view>
  104. <view class="h-money">
  105. <input v-model="reqOrderParm.rechargeAmount" @click="cancelChooseMoney" placeholder="请输入金额" type="number">
  106. </view>
  107. </view> -->
  108. <!-- 充值按钮 -->
  109. <view v-if="rechargeList.length > 0" @click="submitOrder()" class="h-submit-btn">
  110. <text>立即充值</text>
  111. </view>
  112. <!-- 用户充值协议 -->
  113. <view class="recharge-agreement">
  114. <view class="radio-group flex-row justify-center">
  115. <radio @click="toggleSelection" style="transform:scale(0.8)" color="#FFE05C" class="v-text" :checked="isSelected" >
  116. 我已阅读并同意<text @click.stop="gotoTermOfService(8)" class="h-btn">《储值协议》</text>
  117. </radio>
  118. </view>
  119. </view>
  120. <!-- 使用说明 -->
  121. <view>
  122. <rich-text v-html="aboutContent">
  123. </rich-text>
  124. </view>
  125. <!-- <view class="h-desc">-->
  126. <!-- <view class="title">-->
  127. <!-- <text>储值使用说明</text>-->
  128. <!-- </view>-->
  129. <!-- <view class="h-content">-->
  130. <!-- <view class="h-v-text">-->
  131. <!-- <text>1、 这上面的夜的天空,奇怪而高,我生平。</text>-->
  132. <!-- </view>-->
  133. <!-- <view class="h-v-text">-->
  134. <!-- <text>2、 这上面的夜的天空,奇怪而高,我生平。</text>-->
  135. <!-- </view>-->
  136. <!-- <view class="h-v-text">-->
  137. <!-- <text>3、 这上面的夜的天空,奇怪而高,我生平。</text>-->
  138. <!-- </view>-->
  139. <!-- <view class="h-v-text">-->
  140. <!-- <text>4、 这上面的夜的天空,奇怪而高,我生平。</text>-->
  141. <!-- </view>-->
  142. <!-- <view class="h-v-text">-->
  143. <!-- <text>5、 这上面的夜的天空,奇怪而高,我生平。</text>-->
  144. <!-- </view>-->
  145. <!-- -->
  146. <!-- </view>-->
  147. <!-- </view>-->
  148. </view>
  149. </view>
  150. </view>
  151. </template>
  152. <script>
  153. export default {
  154. data() {
  155. return {
  156. aboutContent:'',
  157. show: false,
  158. currentTab: '', // 当前选中的 Tab
  159. isSelected: true,
  160. userInfo: {},
  161. reqOrderParm: {
  162. auth: true,
  163. orderType: 3, // 订单类型;1-服务订单 2-产品订单 3-充值订单
  164. rechargeAmount: null, // 充值金额
  165. strategyId: null, // 优惠策略的ID 测试id 1694514233806888962
  166. remark: null
  167. },
  168. reqPayParm: {
  169. auth: true,
  170. orderNo: null,
  171. openid: null,
  172. requstForm: true
  173. },
  174. rechargeList: [],
  175. };
  176. },
  177. onLoad() {
  178. this.AboutByType()
  179. },
  180. onShow() {
  181. // 获取充值面额
  182. this.getRechargeList();
  183. // 用户信息
  184. this.userInfo = uni.getStorageSync('userInfo');
  185. },
  186. methods: {
  187. AboutByType(type) {
  188. this.$api.AboutByType({type:9}).then(res => {
  189. this.aboutContent = res.data.data.aboutContent
  190. console.log(res,'333333333333')
  191. })
  192. },
  193. // 获取充值面额
  194. getRechargeList(){
  195. console.log('+++++++++666666666666666666+++++++++++++++++++')
  196. this.$api.getRechargeList(this.reqOrderParm).then((res)=>{
  197. console.log('++++++++++++++getRechargeList+++++++++++++++++',res)
  198. this.rechargeList = res.data.data;
  199. })
  200. },
  201. // 提交订单
  202. submitOrder(){
  203. const that = this;
  204. if(!this.isSelected){ // 是否确定协议
  205. uni.showToast({
  206. title: '请选择充值协议!'
  207. });
  208. return;
  209. }
  210. if(this.reqOrderParm.strategyId == null){
  211. uni.showToast({
  212. title: '请选择充值项目!'
  213. });
  214. return;
  215. }
  216. // 提交订单
  217. this.$api.commonGeneralOrder(this.reqOrderParm).then((res)=>{
  218. console.log('+++++++++++commonGeneralOrder++++++++++',res)
  219. that.reqPayParm.orderNo = res.data.data.orderNo;
  220. // 调用微信支付
  221. that.wechatPay();
  222. })
  223. },
  224. // 微信支付
  225. wechatPay(){
  226. const that = this;
  227. // 用户信息
  228. that.reqPayParm.requstForm = true;
  229. this.$api.wechatPay(that.reqPayParm).then((res)=>{
  230. var param = res.data.data;
  231. uni.requestPayment({
  232. appId: param.appid,
  233. timeStamp: param.timestamp+"",
  234. nonceStr: param.noncestr,
  235. package: "prepay_id="+param.prepayid,
  236. signType: "RSA",
  237. paySign: param.sign,
  238. success: res => {
  239. uni.showToast({
  240. title: '支付成功!'
  241. });
  242. // 刷新用户信息
  243. that.getUserInfo()
  244. },
  245. fail: res => {
  246. uni.showModal({
  247. content: '支付失败',
  248. showCancel: false
  249. });
  250. }
  251. });
  252. })
  253. },
  254. getUserInfo(){
  255. this.$api.getUserInfo().then(res=>{
  256. console.log('++++++++++++获取用户信息++++++++++++++++++',res)
  257. uni.setStorageSync('userInfo',res.data.data)
  258. this.userInfo = res.data.data
  259. })
  260. },
  261. // 取消上面选择的面值
  262. cancelChooseMoney(){
  263. this.reqOrderParm.strategyId = null;
  264. this.reqOrderParm.rechargeAmount = null;
  265. this.currentTab = '';
  266. },
  267. // 选择充值金额
  268. selectActiveRecharge(item,index){
  269. // 设置充值的金额和策略ID
  270. this.reqOrderParm.strategyId = item.id;
  271. this.reqOrderParm.rechargeAmount = item.reachPrice;
  272. this.currentTab = index;
  273. },
  274. toggleSelection() {
  275. this.isSelected = !this.isSelected;
  276. },
  277. // 交易记录
  278. gotoTransactionRecords(){
  279. uni.navigateTo({
  280. url: '/myPages/transactionRecord/index',
  281. params: {}
  282. })
  283. },
  284. // 充值记录
  285. gotoTransactionOrderRecords(){
  286. uni.navigateTo({
  287. url: '/myPages/rechargeRecord/index',
  288. })
  289. },
  290. // 查看储值协议
  291. gotoTermOfService(type){
  292. uni.navigateTo({
  293. url: '/myPages/TermsOfService/index?name='+'储值协议'+'&type=' + 8,
  294. })
  295. },
  296. },
  297. };
  298. </script>
  299. <style scoped lang="scss">
  300. .page{
  301. background: red;
  302. }
  303. /*scroll-view外层*/
  304. .skill-sequence-panel-content-wrapper {
  305. position: relative;
  306. white-space: nowrap;
  307. // padding: 10rpx 0 10rpx 10rpx;
  308. margin-top: 10px;
  309. }
  310. /*左右渐变遮罩*/
  311. .hide-content-box {
  312. position: absolute;
  313. top: 0;
  314. height: 100%;
  315. width: 10px;
  316. z-index: 2;
  317. }
  318. .hide-content-box-left {
  319. left: 0;
  320. background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
  321. }
  322. .hide-content-box-right {
  323. right: 0;
  324. background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
  325. }
  326. .kite-classify-scroll {
  327. width: 100%;
  328. // height: 380rpx;
  329. overflow: hidden;
  330. white-space: nowrap;
  331. }
  332. .kite-classify-cell {
  333. display: inline-block;
  334. width: 266rpx;
  335. // height: 370rpx;
  336. margin-right: 20rpx;
  337. background-color: #ffffff;
  338. border-radius: 10rpx;
  339. overflow: hidden;
  340. box-shadow: 2px 2px 3px rgba(26, 26, 26, 0.2);
  341. position: relative;
  342. .h-bg-img{
  343. image{
  344. height: 80px;
  345. }
  346. }
  347. .content{
  348. position: absolute;
  349. bottom: 20%;
  350. left:12px;
  351. .money{
  352. color: #333333;
  353. .v{
  354. font-size: 18px;
  355. font-weight: bold;
  356. }
  357. }
  358. .desc{
  359. margin-top: 6px;
  360. font-size: 12px;
  361. color: #333333;
  362. line-height: 22px;
  363. }
  364. }
  365. .active{
  366. display: block;
  367. }
  368. }
  369. // 余额
  370. .recharge-me{
  371. position: relative;
  372. .bg-img{
  373. height: 160px;
  374. background: #FFE05C;
  375. }
  376. .wallet-content{
  377. position: absolute;
  378. top: 0;
  379. left: 0;
  380. right: 0;
  381. padding: 12px;
  382. .h-balance-wrap{
  383. background: #FFFCF1 ;
  384. border-radius: 6px;
  385. text-align: center;
  386. padding-left: 20px;
  387. padding-right: 20px;
  388. .h-balance{
  389. display: flex;
  390. justify-content: space-between;
  391. align-items: center;
  392. height: 118px;
  393. .recharge-balance{
  394. font-family: PingFangSC-Regular, PingFang SC;
  395. .h-nav-img {
  396. image{
  397. height: 18px;
  398. width: 18px;
  399. }
  400. }
  401. .name{
  402. font-size: 14px;
  403. font-weight: 400;
  404. color: #666666;
  405. line-height: 22px;
  406. }
  407. .balance-value{
  408. font-size: 18px;
  409. font-weight: bold;
  410. color: #333333;
  411. line-height: 26px;
  412. }
  413. }
  414. }
  415. .btn{
  416. display: flex;
  417. font-size: 14px;
  418. justify-content: space-between;
  419. height: 60px;
  420. align-items: center;
  421. color: #999999;
  422. .item-btn{
  423. width: 50%;
  424. }
  425. }
  426. }
  427. }
  428. }
  429. // 充值金额选择
  430. .recharge-content-wrap{
  431. width: 100%;
  432. display: flex;
  433. flex-wrap: wrap;
  434. justify-content: space-between;
  435. margin-top: 12px;
  436. position: relative;
  437. .recharge-content{
  438. width: calc(50% - 6px);
  439. margin-bottom: 12px;
  440. position: relative;
  441. .h-bg-img{
  442. image{
  443. height: 80px;
  444. }
  445. }
  446. .content{
  447. position: absolute;
  448. bottom: 25%;
  449. left:12px;
  450. .money{
  451. color: #333333;
  452. .v{
  453. font-size: 18px;
  454. font-weight: bold;
  455. }
  456. }
  457. .desc{
  458. font-size: 12px;
  459. color: #333333;
  460. line-height: 22px;
  461. }
  462. }
  463. .choose-status{
  464. display: none;
  465. position: absolute;
  466. left: 0px;
  467. top: 0px;
  468. .active{
  469. width: 0;
  470. height: 0;
  471. border-left: 0px solid transparent;
  472. border-right: 30px solid transparent;
  473. border-top: 30px solid green;
  474. }
  475. image{
  476. height: 40px;
  477. width: 40px;
  478. }
  479. }
  480. .active{
  481. display: block;
  482. }
  483. }
  484. }
  485. .h-custom{
  486. background: #FFFCF1;
  487. display: flex;
  488. padding: 12px;
  489. border-radius: 10px;
  490. margin-top: 8px;
  491. .h-money{
  492. margin-left: 6px;
  493. }
  494. }
  495. // 协议
  496. .recharge-agreement{
  497. margin-top: 12px;
  498. margin-bottom: 12px;
  499. margin-left: 12px;
  500. text-align: center;
  501. .radio-group{
  502. .v-text{
  503. // color:green;
  504. }
  505. .h-btn{
  506. color:red;
  507. }
  508. }
  509. }
  510. // 提交按钮
  511. .h-submit-btn{
  512. margin-top: 12px;
  513. width: 343px;
  514. height: 42px;
  515. background: #FFE05C;
  516. border-radius: 27px;
  517. text-align: center;
  518. line-height: 42px;
  519. }
  520. // 使用说明
  521. .h-desc{
  522. font-family: PingFangSC-Regular, PingFang SC;
  523. .title{
  524. height: 24px;
  525. font-size: 14px;
  526. font-family: PingFangSC-Regular, PingFang SC;
  527. font-weight: 400;
  528. color: #333333;
  529. line-height: 24px;
  530. }
  531. .h-content{
  532. height: 40px;
  533. font-size: 12px;
  534. font-weight: 400;
  535. color: #999999;
  536. line-height: 20px;
  537. }
  538. }
  539. </style>