index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  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. <!-- <view class="itemTitle">-->
  52. <!-- <text>活动项目</text>-->
  53. <!-- </view>-->
  54. <!-- <scroll-view scroll-x="true" class="kite-classify-scroll">-->
  55. <!-- <view class="kite-classify-cell" v-for="(item, index) in activityList" :key="index" @click="goDetail(item)">-->
  56. <!-- <view class="money">-->
  57. <!-- <text class="v">{{item.salePrice}}</text>-->
  58. <!-- </view>-->
  59. <!-- <view class="desc">-->
  60. <!-- <text>{{item.title}} </text>-->
  61. <!-- </view>-->
  62. <!-- </view>-->
  63. <!-- </scroll-view>-->
  64. <!-- </view>-->
  65. <view class="skill-sequence-panel-content-wrapper">
  66. <!-- <view class="itemTitle">-->
  67. <!-- <text>储值项目</text>-->
  68. <!-- </view>-->
  69. <scroll-view scroll-x="true" class="kite-classify-scroll">
  70. <view @click="selectActiveRecharge(item,index)" class="kite-classify-cell1" :class="{kiteBackImg:currentTab === index}" v-for="(item, index) in rechargeList" :key="index">
  71. <view class="money">
  72. <text class="v">{{item.reachPrice}}</text>
  73. </view>
  74. <view class="desc">
  75. <text>{{item.name}} </text>
  76. </view>
  77. <view v-if="item.remark" @click.stop="seeDetail(item)">
  78. <text class="detail">详情</text>
  79. </view>
  80. </view>
  81. </scroll-view>
  82. </view>
  83. <!-- 自定义充值金额 -->
  84. <view class="h-custom">
  85. <!-- <view class="h-icon">-->
  86. <!-- <u-icon name="rmb" color="#333" size="22"></u-icon>-->
  87. <!-- </view>-->
  88. <view class="h-money">
  89. <input v-model="reqOrderParm.rechargeAmount" @click="cancelChooseMoney" placeholder="请输入金额" type="digit">
  90. </view>
  91. </view>
  92. <!-- 充值按钮 -->
  93. <view v-if="rechargeList.length > 0" @click="submitOrder()" class="h-submit-btn">
  94. <text>立即充值</text>
  95. </view>
  96. <!-- 用户充值协议 -->
  97. <view class="recharge-agreement">
  98. <view class="radio-group flex-row justify-center">
  99. <radio @click="toggleSelection" style="transform:scale(0.8)" color="#FFE05C" class="v-text" :checked="isSelected" >
  100. 我已阅读并同意<text @click.stop="gotoTermOfService(8)" class="h-btn">《储值协议》</text>
  101. </radio>
  102. </view>
  103. </view>
  104. <!-- 使用说明 -->
  105. <view class="serobReminder">
  106. <rich-text v-html="aboutContent">
  107. </rich-text>
  108. </view>
  109. </view>
  110. </view>
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. activityList:[],
  118. aboutContent:'',
  119. show: false,
  120. currentTab: '', // 当前选中的 Tab
  121. isSelected: false,
  122. userInfo: {},
  123. reqOrderParm: {
  124. auth: true,
  125. orderType: 3, // 订单类型;1-服务订单 2-产品订单 3-充值订单
  126. rechargeAmount: null, // 充值金额
  127. strategyId: null, // 优惠策略的ID 测试id 1694514233806888962
  128. remark: null
  129. },
  130. reqPayParm: {
  131. auth: true,
  132. orderNo: null,
  133. openid: null,
  134. requstForm: true
  135. },
  136. rechargeList: [],
  137. };
  138. },
  139. onLoad(option) {
  140. this.AboutByType()
  141. },
  142. onShow() {
  143. // 获取充值面额
  144. this.getRechargeList();
  145. // 获取活动列表
  146. this.getActivityList();
  147. // 用户信息
  148. this.userInfo = uni.getStorageSync('userInfo');
  149. },
  150. methods: {
  151. goDetail(item){
  152. uni.navigateTo({
  153. url:'/orderPages/activityDetail/activityDetail?id=' + item.id
  154. })
  155. },
  156. getActivityList(){
  157. this.$api.activityList({
  158. pageNum: 1,
  159. pageSize: 1000,
  160. }).then((res) => {
  161. this.activityList = res.data.rows;
  162. }).catch((err) => {
  163. })
  164. },
  165. AboutByType(type) {
  166. this.$api.AboutByType({type:9}).then(res => {
  167. this.aboutContent = res.data.data.aboutContent
  168. })
  169. },
  170. seeDetail(item){
  171. uni.showModal({
  172. title:"储值详情",
  173. content: item.remark,
  174. showCancel:false,
  175. confirmText:"确定"
  176. })
  177. },
  178. // 获取充值面额
  179. getRechargeList(){
  180. this.$api.getRechargeList().then((res)=>{
  181. this.rechargeList = res.data.data;
  182. })
  183. },
  184. // 提交订单
  185. submitOrder(){
  186. if (!this.userInfo.phone){
  187. uni.showModal({
  188. title:'温馨提示',
  189. content:'充值涉及资金安全,需绑定手机号才能进行充值,是否确认绑定手机号',
  190. success:res=>{
  191. if (res.confirm){
  192. uni.navigateTo({
  193. url: '/myPages/setting/setting-telphone',
  194. })
  195. }
  196. }
  197. })
  198. return
  199. }
  200. const that = this;
  201. if(!this.isSelected){ // 是否确定协议
  202. uni.showToast({
  203. icon: 'none',
  204. title: '请同意充值协议!'
  205. });
  206. return;
  207. }
  208. if(!this.reqOrderParm.rechargeAmount){
  209. uni.showToast({
  210. icon: 'none',
  211. title: '请输入或选择充值金额!'
  212. });
  213. return;
  214. }
  215. if(!this.reqOrderParm.strategyId){
  216. if(parseFloat(this.reqOrderParm.rechargeAmount).toString() == "NaN" ){
  217. uni.showToast({
  218. icon: 'none',
  219. title: '请输入正确的金额'
  220. });
  221. return;
  222. }
  223. if(this.reqOrderParm.rechargeAmount <1 ||this.reqOrderParm.rechargeAmount>100 ){
  224. uni.showToast({
  225. icon: 'none',
  226. title: '任意充金额须在1-100之间 并且必须为数字'
  227. });
  228. return;
  229. }
  230. uni.showModal({
  231. title: '警告!',
  232. content: '您选择任意充不会获得任何优惠,是否确认充值??',
  233. success: function (res) {
  234. if (res.confirm) {
  235. console.log('用户点击确定');
  236. that.handleCommon()
  237. } else if (res.cancel) {
  238. console.log('用户点击取消');
  239. return;
  240. }
  241. }
  242. });
  243. }else {
  244. this.handleCommon()
  245. }
  246. },
  247. //提交充值订单
  248. handleCommon(){
  249. const that = this;
  250. let param = uni.getStorageSync('promotionParam')
  251. console.log('获取到技师的二维码数据',param)
  252. if (!param){
  253. console.log('获取到门店的二维码数据',param)
  254. param = uni.getStorageSync('storeParam')
  255. }
  256. Object.assign(this.reqOrderParm,param)
  257. // 提交订单
  258. this.$api.commonGeneralOrder(this.reqOrderParm).then((res)=>{
  259. console.log('+++++++++++commonGeneralOrder++++++++++',res)
  260. that.reqPayParm.orderNo = res.data.data.orderNo;
  261. // 调用微信支付
  262. that.wechatPay();
  263. }).catch((res)=>{
  264. console.log(res,'222222')
  265. })
  266. },
  267. // 微信支付
  268. wechatPay(){
  269. const that = this;
  270. // 用户信息
  271. that.reqPayParm.requstForm = true;
  272. this.$api.wechatPay(that.reqPayParm).then((res)=>{
  273. var param = res.data.data;
  274. uni.requestPayment({
  275. appId: param.appid,
  276. timeStamp: param.timestamp+"",
  277. nonceStr: param.noncestr,
  278. package: "prepay_id="+param.prepayid,
  279. signType: "RSA",
  280. paySign: param.sign,
  281. success: res => {
  282. uni.showToast({
  283. title: '支付成功!'
  284. });
  285. // 刷新用户信息
  286. that.getUserInfo()
  287. },
  288. fail: err => {
  289. console.log(err)
  290. if (err.errMsg === "requestPayment:fail cancel"){
  291. uni.showModal({
  292. content: '支付取消',
  293. showCancel: false
  294. });
  295. }else {
  296. uni.showModal({
  297. content: '支付失败',
  298. showCancel: false
  299. });
  300. }
  301. }
  302. });
  303. })
  304. },
  305. getUserInfo(){
  306. this.$api.getUserInfo().then(res=>{
  307. console.log('++++++++++++获取用户信息++++++++++++++++++',res)
  308. uni.setStorageSync('userInfo',res.data.data)
  309. this.userInfo = res.data.data
  310. })
  311. },
  312. // 取消上面选择的面值
  313. cancelChooseMoney(){
  314. this.reqOrderParm.strategyId = null;
  315. this.reqOrderParm.rechargeAmount = null;
  316. this.currentTab = '';
  317. },
  318. // 选择充值金额
  319. selectActiveRecharge(item,index){
  320. // 设置充值的金额和策略ID
  321. this.reqOrderParm.strategyId = item.id;
  322. this.reqOrderParm.rechargeAmount = item.reachPrice;
  323. this.currentTab = index;
  324. },
  325. toggleSelection() {
  326. this.isSelected = !this.isSelected;
  327. },
  328. // 交易记录
  329. gotoTransactionRecords(){
  330. uni.navigateTo({
  331. url: '/myPages/transactionRecord/index',
  332. params: {}
  333. })
  334. },
  335. // 充值记录
  336. gotoTransactionOrderRecords(){
  337. uni.navigateTo({
  338. url: '/myPages/rechargeRecord/index',
  339. })
  340. },
  341. // 查看储值协议
  342. gotoTermOfService(type){
  343. uni.navigateTo({
  344. url: '/myPages/TermsOfService/index?name='+'储值协议'+'&type=' + 8,
  345. })
  346. },
  347. },
  348. };
  349. </script>
  350. <style scoped lang="scss">
  351. @import '/common/css/common.css';
  352. /*scroll-view外层*/
  353. .skill-sequence-panel-content-wrapper {
  354. position: relative;
  355. white-space: nowrap;
  356. // padding: 10rpx 0 10rpx 10rpx;
  357. margin-top: 10px;
  358. }
  359. /*左右渐变遮罩*/
  360. .hide-content-box {
  361. position: absolute;
  362. top: 0;
  363. height: 100%;
  364. width: 10px;
  365. z-index: 2;
  366. }
  367. .hide-content-box-left {
  368. left: 0;
  369. background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
  370. }
  371. .hide-content-box-right {
  372. right: 0;
  373. background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
  374. }
  375. .kite-classify-scroll {
  376. width: 100%;
  377. // height: 380rpx;
  378. overflow: hidden;
  379. white-space: nowrap;
  380. }
  381. .kite-classify-cell {
  382. background-image: url("/static/recharge/dianka1.png");
  383. background-repeat: no-repeat;
  384. background-size: cover;
  385. display: inline-block;
  386. width: 328rpx;
  387. height: 160rpx;
  388. margin-right: 20rpx;
  389. border-radius: 15rpx;
  390. overflow: hidden;
  391. .money{
  392. margin: 34rpx 0 0 40rpx;
  393. color: #333333;
  394. .v{
  395. font-size: 18px;
  396. font-weight: bold;
  397. }
  398. }
  399. .desc{
  400. margin-top: 15rpx;
  401. margin-left: 40rpx;
  402. font-size: 12px;
  403. color: #333333;
  404. line-height: 22px;
  405. }
  406. }
  407. .kite-classify-cell1 {
  408. background-image: url("/static/recharge/dianka.png");
  409. background-repeat: no-repeat;
  410. background-size: cover;
  411. display: inline-block;
  412. width: 328rpx;
  413. height: 160rpx;
  414. margin-right: 20rpx;
  415. border-radius: 15rpx;
  416. overflow: hidden;
  417. .money{
  418. margin: 20rpx 0 0 40rpx;
  419. color: #333333;
  420. .v{
  421. font-size: 18px;
  422. font-weight: bold;
  423. }
  424. }
  425. .desc{
  426. margin-left: 40rpx;
  427. font-size: 12px;
  428. color: #333333;
  429. line-height: 22px;
  430. }
  431. .detail {
  432. color: #999999;
  433. font-size: 22rpx;
  434. padding: 0 6rpx;
  435. border-radius: 10rpx;
  436. margin-left: 38rpx;
  437. }
  438. }
  439. .kiteBackImg{
  440. background-image: url("/static/transaction/u2.png");
  441. background-repeat: no-repeat;
  442. background-size: cover;
  443. }
  444. // 余额
  445. .recharge-me{
  446. .wallet-content{
  447. background-image: linear-gradient(#FFE05C 0, #FFE05C 160px, #F7F7F7 0, #F7F7F7);
  448. padding: 12px;
  449. .h-balance-wrap{
  450. background: #FFFCF1 ;
  451. border-radius: 6px;
  452. text-align: center;
  453. padding-left: 20px;
  454. padding-right: 20px;
  455. .h-balance{
  456. display: flex;
  457. justify-content: space-between;
  458. align-items: center;
  459. height: 118px;
  460. .recharge-balance{
  461. font-family: PingFangSC-Regular, PingFang SC;
  462. .h-nav-img {
  463. image{
  464. height: 18px;
  465. width: 18px;
  466. }
  467. }
  468. .name{
  469. font-size: 14px;
  470. font-weight: 400;
  471. color: #666666;
  472. line-height: 22px;
  473. }
  474. .balance-value{
  475. font-size: 18px;
  476. font-weight: bold;
  477. color: #333333;
  478. line-height: 26px;
  479. }
  480. }
  481. }
  482. .btn{
  483. display: flex;
  484. font-size: 14px;
  485. justify-content: space-between;
  486. height: 60px;
  487. align-items: center;
  488. color: #999999;
  489. .item-btn{
  490. width: 50%;
  491. }
  492. }
  493. }
  494. }
  495. }
  496. // 充值金额选择
  497. .recharge-content-wrap{
  498. width: 100%;
  499. display: flex;
  500. flex-wrap: wrap;
  501. justify-content: space-between;
  502. margin-top: 12px;
  503. position: relative;
  504. .recharge-content{
  505. width: calc(50% - 6px);
  506. margin-bottom: 12px;
  507. position: relative;
  508. .content{
  509. position: absolute;
  510. bottom: 25%;
  511. left:12px;
  512. .money{
  513. color: #333333;
  514. .v{
  515. font-size: 18px;
  516. font-weight: bold;
  517. }
  518. }
  519. .desc{
  520. font-size: 12px;
  521. color: #333333;
  522. line-height: 22px;
  523. }
  524. }
  525. .choose-status{
  526. display: none;
  527. position: absolute;
  528. left: 0px;
  529. top: 0px;
  530. .active{
  531. width: 0;
  532. height: 0;
  533. border-left: 0px solid transparent;
  534. border-right: 30px solid transparent;
  535. border-top: 30px solid green;
  536. }
  537. image{
  538. height: 40px;
  539. width: 40px;
  540. }
  541. }
  542. .active{
  543. display: block;
  544. }
  545. }
  546. }
  547. .h-custom{
  548. background: #FFFCF1;
  549. display: flex;
  550. padding: 12px;
  551. border-radius: 10px;
  552. margin-top: 8px;
  553. .h-money{
  554. margin-left: 6px;
  555. }
  556. }
  557. // 协议
  558. .recharge-agreement{
  559. margin-top: 12px;
  560. margin-bottom: 12px;
  561. margin-left: 12px;
  562. text-align: center;
  563. .radio-group{
  564. .v-text{
  565. // color:green;
  566. }
  567. .h-btn{
  568. color:red;
  569. }
  570. }
  571. }
  572. // 提交按钮
  573. .h-submit-btn{
  574. margin-top: 24rpx;
  575. height: 84rpx;
  576. background: #FFE05C;
  577. border-radius: 54rpx;
  578. text-align: center;
  579. line-height: 84rpx;
  580. }
  581. .bg-img{
  582. height: 160px;
  583. background: #FFE05C;
  584. }
  585. .itemTitle {
  586. color: #333333;
  587. font-size: 28rpx;
  588. font-weight: bold;
  589. margin-bottom: 20rpx;
  590. }
  591. .serobReminder {
  592. font-size: 28rpx;
  593. color: #999999;
  594. }
  595. </style>