index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660
  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. uni.removeStorageSync('promotionParam');
  289. },
  290. fail: err => {
  291. console.log(err)
  292. if (err.errMsg === "requestPayment:fail cancel"){
  293. uni.showModal({
  294. content: '支付取消',
  295. showCancel: false
  296. });
  297. }else {
  298. uni.showModal({
  299. content: '支付失败',
  300. showCancel: false
  301. });
  302. }
  303. }
  304. });
  305. })
  306. },
  307. getUserInfo(){
  308. this.$api.getUserInfo().then(res=>{
  309. console.log('++++++++++++获取用户信息++++++++++++++++++',res)
  310. uni.setStorageSync('userInfo',res.data.data)
  311. this.userInfo = res.data.data
  312. })
  313. },
  314. // 取消上面选择的面值
  315. cancelChooseMoney(){
  316. this.reqOrderParm.strategyId = null;
  317. this.reqOrderParm.rechargeAmount = null;
  318. this.currentTab = '';
  319. },
  320. // 选择充值金额
  321. selectActiveRecharge(item,index){
  322. // 设置充值的金额和策略ID
  323. this.reqOrderParm.strategyId = item.id;
  324. this.reqOrderParm.rechargeAmount = item.reachPrice;
  325. this.currentTab = index;
  326. },
  327. toggleSelection() {
  328. this.isSelected = !this.isSelected;
  329. },
  330. // 交易记录
  331. gotoTransactionRecords(){
  332. uni.navigateTo({
  333. url: '/myPages/transactionRecord/index',
  334. params: {}
  335. })
  336. },
  337. // 充值记录
  338. gotoTransactionOrderRecords(){
  339. uni.navigateTo({
  340. url: '/myPages/rechargeRecord/index',
  341. })
  342. },
  343. // 查看储值协议
  344. gotoTermOfService(type){
  345. uni.navigateTo({
  346. url: '/myPages/TermsOfService/index?name='+'储值协议'+'&type=' + 8,
  347. })
  348. },
  349. },
  350. };
  351. </script>
  352. <style scoped lang="scss">
  353. @import '/common/css/common.css';
  354. /*scroll-view外层*/
  355. .skill-sequence-panel-content-wrapper {
  356. position: relative;
  357. white-space: nowrap;
  358. // padding: 10rpx 0 10rpx 10rpx;
  359. margin-top: 10px;
  360. }
  361. /*左右渐变遮罩*/
  362. .hide-content-box {
  363. position: absolute;
  364. top: 0;
  365. height: 100%;
  366. width: 10px;
  367. z-index: 2;
  368. }
  369. .hide-content-box-left {
  370. left: 0;
  371. background-image: linear-gradient(to left, rgba(255, 255, 255, 0), #f3f3f3 60%);
  372. }
  373. .hide-content-box-right {
  374. right: 0;
  375. background-image: linear-gradient(to right, rgba(255, 255, 255, 0), #f3f3f3 60%);
  376. }
  377. .kite-classify-scroll {
  378. width: 100%;
  379. // height: 380rpx;
  380. overflow: hidden;
  381. white-space: nowrap;
  382. }
  383. .kite-classify-cell {
  384. background-image: url("/static/recharge/dianka1.png");
  385. background-repeat: no-repeat;
  386. background-size: cover;
  387. display: inline-block;
  388. width: 328rpx;
  389. height: 160rpx;
  390. margin-right: 20rpx;
  391. border-radius: 15rpx;
  392. overflow: hidden;
  393. .money{
  394. margin: 34rpx 0 0 40rpx;
  395. color: #333333;
  396. .v{
  397. font-size: 18px;
  398. font-weight: bold;
  399. }
  400. }
  401. .desc{
  402. margin-top: 15rpx;
  403. margin-left: 40rpx;
  404. font-size: 12px;
  405. color: #333333;
  406. line-height: 22px;
  407. }
  408. }
  409. .kite-classify-cell1 {
  410. background-image: url("/static/recharge/dianka.png");
  411. background-repeat: no-repeat;
  412. background-size: cover;
  413. display: inline-block;
  414. width: 328rpx;
  415. height: 160rpx;
  416. margin-right: 20rpx;
  417. border-radius: 15rpx;
  418. overflow: hidden;
  419. .money{
  420. margin: 20rpx 0 0 40rpx;
  421. color: #333333;
  422. .v{
  423. font-size: 18px;
  424. font-weight: bold;
  425. }
  426. }
  427. .desc{
  428. margin-left: 40rpx;
  429. font-size: 12px;
  430. color: #333333;
  431. line-height: 22px;
  432. }
  433. .detail {
  434. color: #999999;
  435. font-size: 22rpx;
  436. padding: 0 6rpx;
  437. border-radius: 10rpx;
  438. margin-left: 38rpx;
  439. }
  440. }
  441. .kiteBackImg{
  442. background-image: url("/static/transaction/u2.png");
  443. background-repeat: no-repeat;
  444. background-size: cover;
  445. }
  446. // 余额
  447. .recharge-me{
  448. .wallet-content{
  449. background-image: linear-gradient(#FFE05C 0, #FFE05C 160px, #F7F7F7 0, #F7F7F7);
  450. padding: 12px;
  451. .h-balance-wrap{
  452. background: #FFFCF1 ;
  453. border-radius: 6px;
  454. text-align: center;
  455. padding-left: 20px;
  456. padding-right: 20px;
  457. .h-balance{
  458. display: flex;
  459. justify-content: space-between;
  460. align-items: center;
  461. height: 118px;
  462. .recharge-balance{
  463. font-family: PingFangSC-Regular, PingFang SC;
  464. .h-nav-img {
  465. image{
  466. height: 18px;
  467. width: 18px;
  468. }
  469. }
  470. .name{
  471. font-size: 14px;
  472. font-weight: 400;
  473. color: #666666;
  474. line-height: 22px;
  475. }
  476. .balance-value{
  477. font-size: 18px;
  478. font-weight: bold;
  479. color: #333333;
  480. line-height: 26px;
  481. }
  482. }
  483. }
  484. .btn{
  485. display: flex;
  486. font-size: 14px;
  487. justify-content: space-between;
  488. height: 60px;
  489. align-items: center;
  490. color: #999999;
  491. .item-btn{
  492. width: 50%;
  493. }
  494. }
  495. }
  496. }
  497. }
  498. // 充值金额选择
  499. .recharge-content-wrap{
  500. width: 100%;
  501. display: flex;
  502. flex-wrap: wrap;
  503. justify-content: space-between;
  504. margin-top: 12px;
  505. position: relative;
  506. .recharge-content{
  507. width: calc(50% - 6px);
  508. margin-bottom: 12px;
  509. position: relative;
  510. .content{
  511. position: absolute;
  512. bottom: 25%;
  513. left:12px;
  514. .money{
  515. color: #333333;
  516. .v{
  517. font-size: 18px;
  518. font-weight: bold;
  519. }
  520. }
  521. .desc{
  522. font-size: 12px;
  523. color: #333333;
  524. line-height: 22px;
  525. }
  526. }
  527. .choose-status{
  528. display: none;
  529. position: absolute;
  530. left: 0px;
  531. top: 0px;
  532. .active{
  533. width: 0;
  534. height: 0;
  535. border-left: 0px solid transparent;
  536. border-right: 30px solid transparent;
  537. border-top: 30px solid green;
  538. }
  539. image{
  540. height: 40px;
  541. width: 40px;
  542. }
  543. }
  544. .active{
  545. display: block;
  546. }
  547. }
  548. }
  549. .h-custom{
  550. background: #FFFCF1;
  551. display: flex;
  552. padding: 12px;
  553. border-radius: 10px;
  554. margin-top: 8px;
  555. .h-money{
  556. margin-left: 6px;
  557. }
  558. }
  559. // 协议
  560. .recharge-agreement{
  561. margin-top: 12px;
  562. margin-bottom: 12px;
  563. margin-left: 12px;
  564. text-align: center;
  565. .radio-group{
  566. .v-text{
  567. // color:green;
  568. }
  569. .h-btn{
  570. color:red;
  571. }
  572. }
  573. }
  574. // 提交按钮
  575. .h-submit-btn{
  576. margin-top: 24rpx;
  577. height: 84rpx;
  578. background: #FFE05C;
  579. border-radius: 54rpx;
  580. text-align: center;
  581. line-height: 84rpx;
  582. }
  583. .bg-img{
  584. height: 160px;
  585. background: #FFE05C;
  586. }
  587. .itemTitle {
  588. color: #333333;
  589. font-size: 28rpx;
  590. font-weight: bold;
  591. margin-bottom: 20rpx;
  592. }
  593. .serobReminder {
  594. font-size: 28rpx;
  595. color: #999999;
  596. }
  597. </style>