index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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" style="background-image: url('/static/recharge/dianka1.png')" 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. })
  176. },
  177. // 获取充值面额
  178. getRechargeList(){
  179. this.$api.getRechargeList().then((res)=>{
  180. this.rechargeList = res.data.data;
  181. })
  182. },
  183. // 提交订单
  184. submitOrder(){
  185. if (!this.userInfo.phone){
  186. uni.showModal({
  187. title:'温馨提示',
  188. content:'充值涉及资金安全,需绑定手机号才能进行充值,是否确认绑定手机号',
  189. success:res=>{
  190. if (res.confirm){
  191. uni.navigateTo({
  192. url: '/myPages/setting/setting-telphone',
  193. })
  194. }
  195. }
  196. })
  197. return
  198. }
  199. const that = this;
  200. if(!this.isSelected){ // 是否确定协议
  201. uni.showToast({
  202. icon: 'none',
  203. title: '请同意充值协议!'
  204. });
  205. return;
  206. }
  207. if(!this.reqOrderParm.rechargeAmount){
  208. uni.showToast({
  209. icon: 'none',
  210. title: '请输入或选择充值金额!'
  211. });
  212. return;
  213. }
  214. if(!this.reqOrderParm.strategyId){
  215. if(parseFloat(this.reqOrderParm.rechargeAmount).toString() == "NaN" ){
  216. uni.showToast({
  217. icon: 'none',
  218. title: '请输入正确的金额'
  219. });
  220. return;
  221. }
  222. if(this.reqOrderParm.rechargeAmount <1 ||this.reqOrderParm.rechargeAmount>100 ){
  223. uni.showToast({
  224. icon: 'none',
  225. title: '任意充金额须在1-100之间 并且必须为数字'
  226. });
  227. return;
  228. }
  229. uni.showModal({
  230. title: '警告!',
  231. content: '您选择任意充不会获得任何优惠,是否确认充值??',
  232. success: function (res) {
  233. if (res.confirm) {
  234. console.log('用户点击确定');
  235. that.handleCommon()
  236. } else if (res.cancel) {
  237. console.log('用户点击取消');
  238. return;
  239. }
  240. }
  241. });
  242. }else {
  243. this.handleCommon()
  244. }
  245. },
  246. //提交充值订单
  247. handleCommon(){
  248. const that = this;
  249. let param = uni.getStorageSync('promotionParam')
  250. console.log('获取到技师的二维码数据',param)
  251. if (!param){
  252. console.log('获取到门店的二维码数据',param)
  253. param = uni.getStorageSync('storeParam')
  254. }
  255. Object.assign(this.reqOrderParm,param)
  256. // 提交订单
  257. this.$api.commonGeneralOrder(this.reqOrderParm).then((res)=>{
  258. console.log('+++++++++++commonGeneralOrder++++++++++',res)
  259. that.reqPayParm.orderNo = res.data.data.orderNo;
  260. // 调用微信支付
  261. that.wechatPay();
  262. }).catch((res)=>{
  263. console.log(res,'222222')
  264. })
  265. },
  266. // 微信支付
  267. wechatPay(){
  268. const that = this;
  269. // 用户信息
  270. that.reqPayParm.requstForm = true;
  271. this.$api.wechatPay(that.reqPayParm).then((res)=>{
  272. var param = res.data.data;
  273. uni.requestPayment({
  274. appId: param.appid,
  275. timeStamp: param.timestamp+"",
  276. nonceStr: param.noncestr,
  277. package: "prepay_id="+param.prepayid,
  278. signType: "RSA",
  279. paySign: param.sign,
  280. success: res => {
  281. uni.showToast({
  282. title: '支付成功!'
  283. });
  284. // 刷新用户信息
  285. that.getUserInfo()
  286. },
  287. fail: err => {
  288. console.log(err)
  289. if (err.errMsg === "requestPayment:fail cancel"){
  290. uni.showModal({
  291. content: '支付取消',
  292. showCancel: false
  293. });
  294. }else {
  295. uni.showModal({
  296. content: '支付失败',
  297. showCancel: false
  298. });
  299. }
  300. }
  301. });
  302. })
  303. },
  304. getUserInfo(){
  305. this.$api.getUserInfo().then(res=>{
  306. console.log('++++++++++++获取用户信息++++++++++++++++++',res)
  307. uni.setStorageSync('userInfo',res.data.data)
  308. this.userInfo = res.data.data
  309. })
  310. },
  311. // 取消上面选择的面值
  312. cancelChooseMoney(){
  313. this.reqOrderParm.strategyId = null;
  314. this.reqOrderParm.rechargeAmount = null;
  315. this.currentTab = '';
  316. },
  317. // 选择充值金额
  318. selectActiveRecharge(item,index){
  319. // 设置充值的金额和策略ID
  320. this.reqOrderParm.strategyId = item.id;
  321. this.reqOrderParm.rechargeAmount = item.reachPrice;
  322. this.currentTab = index;
  323. },
  324. toggleSelection() {
  325. this.isSelected = !this.isSelected;
  326. },
  327. // 交易记录
  328. gotoTransactionRecords(){
  329. uni.navigateTo({
  330. url: '/myPages/transactionRecord/index',
  331. params: {}
  332. })
  333. },
  334. // 充值记录
  335. gotoTransactionOrderRecords(){
  336. uni.navigateTo({
  337. url: '/myPages/rechargeRecord/index',
  338. })
  339. },
  340. // 查看储值协议
  341. gotoTermOfService(type){
  342. uni.navigateTo({
  343. url: '/myPages/TermsOfService/index?name='+'储值协议'+'&type=' + 8,
  344. })
  345. },
  346. },
  347. };
  348. </script>
  349. <style scoped lang="scss">
  350. @import '/common/css/common.css';
  351. /*scroll-view外层*/
  352. .skill-sequence-panel-content-wrapper {
  353. position: relative;
  354. white-space: nowrap;
  355. // padding: 10rpx 0 10rpx 10rpx;
  356. margin-top: 10px;
  357. }
  358. /*左右渐变遮罩*/
  359. .hide-content-box {
  360. position: absolute;
  361. top: 0;
  362. height: 100%;
  363. width: 10px;
  364. z-index: 2;
  365. }
  366. .hide-content-box-left {
  367. left: 0;
  368. background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
  369. }
  370. .hide-content-box-right {
  371. right: 0;
  372. background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
  373. }
  374. .kite-classify-scroll {
  375. width: 100%;
  376. // height: 380rpx;
  377. overflow: hidden;
  378. white-space: nowrap;
  379. }
  380. .kite-classify-cell {
  381. background-image: url("/static/recharge/dianka.png");
  382. background-repeat: no-repeat;
  383. background-size: cover;
  384. display: inline-block;
  385. width: 328rpx;
  386. height: 160rpx;
  387. margin-right: 20rpx;
  388. border-radius: 15rpx;
  389. overflow: hidden;
  390. .money{
  391. margin: 34rpx 0 0 40rpx;
  392. color: #333333;
  393. .v{
  394. font-size: 18px;
  395. font-weight: bold;
  396. }
  397. }
  398. .desc{
  399. margin-top: 15rpx;
  400. margin-left: 40rpx;
  401. font-size: 12px;
  402. color: #333333;
  403. line-height: 22px;
  404. }
  405. }
  406. .kite-classify-cell1 {
  407. background-image: url("/static/recharge/dianka.png");
  408. background-repeat: no-repeat;
  409. background-size: cover;
  410. display: inline-block;
  411. width: 328rpx;
  412. height: 160rpx;
  413. margin-right: 20rpx;
  414. border-radius: 15rpx;
  415. overflow: hidden;
  416. .money{
  417. margin: 20rpx 0 0 40rpx;
  418. color: #333333;
  419. .v{
  420. font-size: 18px;
  421. font-weight: bold;
  422. }
  423. }
  424. .desc{
  425. margin-left: 40rpx;
  426. font-size: 12px;
  427. color: #333333;
  428. line-height: 22px;
  429. }
  430. .detail {
  431. color: #999999;
  432. font-size: 22rpx;
  433. padding: 0 6rpx;
  434. border-radius: 10rpx;
  435. margin-left: 38rpx;
  436. }
  437. }
  438. .kiteBackImg{
  439. background-image: url("/static/transaction/u2.png");
  440. background-repeat: no-repeat;
  441. background-size: cover;
  442. }
  443. // 余额
  444. .recharge-me{
  445. .wallet-content{
  446. background-image: linear-gradient(#FFE05C 0, #FFE05C 160px, #F7F7F7 0, #F7F7F7);
  447. padding: 12px;
  448. .h-balance-wrap{
  449. background: #FFFCF1 ;
  450. border-radius: 6px;
  451. text-align: center;
  452. padding-left: 20px;
  453. padding-right: 20px;
  454. .h-balance{
  455. display: flex;
  456. justify-content: space-between;
  457. align-items: center;
  458. height: 118px;
  459. .recharge-balance{
  460. font-family: PingFangSC-Regular, PingFang SC;
  461. .h-nav-img {
  462. image{
  463. height: 18px;
  464. width: 18px;
  465. }
  466. }
  467. .name{
  468. font-size: 14px;
  469. font-weight: 400;
  470. color: #666666;
  471. line-height: 22px;
  472. }
  473. .balance-value{
  474. font-size: 18px;
  475. font-weight: bold;
  476. color: #333333;
  477. line-height: 26px;
  478. }
  479. }
  480. }
  481. .btn{
  482. display: flex;
  483. font-size: 14px;
  484. justify-content: space-between;
  485. height: 60px;
  486. align-items: center;
  487. color: #999999;
  488. .item-btn{
  489. width: 50%;
  490. }
  491. }
  492. }
  493. }
  494. }
  495. // 充值金额选择
  496. .recharge-content-wrap{
  497. width: 100%;
  498. display: flex;
  499. flex-wrap: wrap;
  500. justify-content: space-between;
  501. margin-top: 12px;
  502. position: relative;
  503. .recharge-content{
  504. width: calc(50% - 6px);
  505. margin-bottom: 12px;
  506. position: relative;
  507. .content{
  508. position: absolute;
  509. bottom: 25%;
  510. left:12px;
  511. .money{
  512. color: #333333;
  513. .v{
  514. font-size: 18px;
  515. font-weight: bold;
  516. }
  517. }
  518. .desc{
  519. font-size: 12px;
  520. color: #333333;
  521. line-height: 22px;
  522. }
  523. }
  524. .choose-status{
  525. display: none;
  526. position: absolute;
  527. left: 0px;
  528. top: 0px;
  529. .active{
  530. width: 0;
  531. height: 0;
  532. border-left: 0px solid transparent;
  533. border-right: 30px solid transparent;
  534. border-top: 30px solid green;
  535. }
  536. image{
  537. height: 40px;
  538. width: 40px;
  539. }
  540. }
  541. .active{
  542. display: block;
  543. }
  544. }
  545. }
  546. .h-custom{
  547. background: #FFFCF1;
  548. display: flex;
  549. padding: 12px;
  550. border-radius: 10px;
  551. margin-top: 8px;
  552. .h-money{
  553. margin-left: 6px;
  554. }
  555. }
  556. // 协议
  557. .recharge-agreement{
  558. margin-top: 12px;
  559. margin-bottom: 12px;
  560. margin-left: 12px;
  561. text-align: center;
  562. .radio-group{
  563. .v-text{
  564. // color:green;
  565. }
  566. .h-btn{
  567. color:red;
  568. }
  569. }
  570. }
  571. // 提交按钮
  572. .h-submit-btn{
  573. margin-top: 24rpx;
  574. height: 84rpx;
  575. background: #FFE05C;
  576. border-radius: 54rpx;
  577. text-align: center;
  578. line-height: 84rpx;
  579. }
  580. .bg-img{
  581. height: 160px;
  582. background: #FFE05C;
  583. }
  584. .itemTitle {
  585. color: #333333;
  586. font-size: 28rpx;
  587. font-weight: bold;
  588. margin-bottom: 20rpx;
  589. }
  590. .serobReminder {
  591. font-size: 28rpx;
  592. color: #999999;
  593. }
  594. </style>