index.vue 13 KB

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