index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521
  1. <template>
  2. <!-- 充值套餐 -->
  3. <view class="mall-recharge">
  4. <view class="white-box">
  5. <view class="account-text">充值账号</view>
  6. <u-input class="account-name" v-model="phone" type="text" maxlength="11" placeholder="请输入手机号" placeholder-style="font-size:32rpx;font-weight:400" fontSize="56rpx" :customStyle="{ padding: '0'}" clearable></u-input>
  7. </view>
  8. <view v-if="phone" class="tip flex aic">
  9. <re-image imgSrc="/retail/mall/ic_tip.png" width="28" height="28"></re-image>
  10. <text>请确认账户是否正确无误</text>
  11. </view>
  12. <view class="list-title flex aic">
  13. <span class="title-line"></span>
  14. 您选择的游戏币套餐
  15. </view>
  16. <view class="order-info">
  17. <view class="info-top">
  18. <view class="top-nums flex jcsb aic">
  19. <view>
  20. <span class="yxb-num">{{data.gameCurrency}}</span>
  21. <span class="yxb-text">游戏币</span>
  22. </view>
  23. <view>
  24. <span class="price-text">¥</span>
  25. <span class="price-num">{{data.discountPrice}}</span>
  26. </view>
  27. </view>
  28. <view class="info-msg flex jcsb aic">
  29. <view class="msg-left">
  30. <span class="zeng" v-if="data.additionalGameCurrency || data.grabTimes">赠</span>
  31. <span class="game-num" v-if="data.additionalGameCurrency">{{data.additionalGameCurrency}}游戏币</span>
  32. <!-- <span class="og">
  33. <span class="${additionalGameCurrency && trafficSize ? 'show' : 'hide'}">+</span>
  34. <span class="bold ${trafficSize ? 'show' : 'hide'}">2M</span>
  35. </span> -->
  36. <span class="og red" v-if="data.additionalGameCurrency && data.grabTimes">
  37. <span style="margin-left:2px">+</span>
  38. <view class="red-box">
  39. <re-image width="30" imgSrc="/retail/main/ic_putonghb.png"></re-image>
  40. <span>红包机会x{{data.grabTimes}}</span>
  41. </view>
  42. </span>
  43. </view>
  44. <span class="time-text">{{data.expireDays}}天有效</span>
  45. </view>
  46. </view>
  47. <view class="info-btm">
  48. <view class="date-wrapper flex jcsb aic">
  49. <view>立即生效</view>
  50. <view class="date-box">{{date}}</view>
  51. </view>
  52. <!-- <view class="jubaopen-ctrl margin-top-20 flex jcsb aic jbp">
  53. <view class="jubaop">
  54. <view class="juntop">
  55. <image class="img-4" src="" alt="" />
  56. <span>聚宝盆余额抵扣</span>
  57. <i class="fx-icon icon-wenhao-xianxingyuankuang"></i>
  58. </view>
  59. <view class="dikou">
  60. <span class="gongyou dikoujine"></span>
  61. <span class="kedi kedikoujine"></span>
  62. </view>
  63. <view class="desc">聚宝盆余额整数部分可参与抵扣</view>
  64. </view>
  65. <image class="img-2 check-icon3-i" src="" alt="" />
  66. <span class="check-icon check-icon3"></span>
  67. </view> -->
  68. <!-- <view class="margin-top-30 flex jcsb aic" id="zfbCtrl">
  69. <view class="flex aic">
  70. <image class="img-3" src="" alt="" />
  71. <span>支付宝支付</span>
  72. </view>
  73. <image class="img-2 check-icon2-i" src="" alt="" />
  74. <span class="check-icon check-icon2"></span>
  75. </view> -->
  76. <view class="wx-ctrl flex jcsb aic">
  77. <view class="flex aic">
  78. <re-image width="48" height="48" imgSrc="/retail/mall/weixin-icon.png" alt="" />
  79. <span style="margin-left:16rpx">微信支付</span>
  80. </view>
  81. <re-image width="48" height="48" imgSrc="/retail/mall/yigou.png" alt="" />
  82. <!-- <span class="check-icon check-icon1"></span> -->
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 支付按钮 -->
  87. <view class="btn-wrapper">
  88. <view id="checkBox" class="margin-bottom-17">
  89. <view class="check-text text-center">点击“确认支付”,即代表您已阅读并同意<span id="agreeEl" class="red">《用户购买协议》</span></view>
  90. </view>
  91. <view class="btns flex jcsb aic safe-area-inset-bottom">
  92. <view>
  93. <span class="btn-price-text1">应付款:</span>
  94. <span class="btn-price-text2">¥</span>
  95. <span class="price-num btn-price-num">{{data.discountPrice}}</span>
  96. </view>
  97. <u-button class="primary-btn" id="buyBtn" @click="confirm()">确认支付</u-button>
  98. </view>
  99. </view>
  100. </view>
  101. </template>
  102. <script>
  103. import { doPay,getPackageDetail } from '@/apis/main'
  104. import { wxPay } from '@/utils/pay.js'
  105. export default {
  106. // components:{
  107. // 'u-input': () => import('@/plugins/uview-ui/components/u-input')
  108. // }
  109. data(){
  110. return{
  111. phone:'',
  112. id:'',
  113. data:'',
  114. date: ''
  115. }
  116. },
  117. onLoad(params){
  118. this.id = params.id
  119. this.getData()
  120. this.getDate()
  121. },
  122. methods: {
  123. // 获取日期
  124. getDate() {
  125. let today = new Date();
  126. let year = today.getFullYear();
  127. let month = today.getMonth() + 1;
  128. let day = today.getDate();
  129. let formattedDate = year + "年" + month + "月" + day + "日";
  130. this.date = formattedDate
  131. },
  132. async getData() {
  133. uni.showLoading()
  134. const res = await getPackageDetail({id:this.id})
  135. if(res){
  136. this.data = res
  137. }
  138. uni.hideLoading();
  139. },
  140. // 确认支付
  141. async confirm(){
  142. uni.showLoading();
  143. let params = {
  144. orderNo: '',
  145. packageId: '',
  146. payChannel: 1,
  147. payType: 1,
  148. phone: this.phone,
  149. }
  150. const res = await doPay(params)
  151. uni.hideLoading();
  152. const payRes = await wxPay(res)
  153. if (payRes) {
  154. uni.navigateTo({
  155. url: `/pages/mall/mallSuccess/index`
  156. })
  157. }
  158. }
  159. }
  160. }
  161. // const data = reactive({
  162. // })
  163. </script>
  164. <style lang="scss">
  165. .mall-recharge {
  166. padding: 32rpx;
  167. .white-box {
  168. padding: 48rpx 48rpx 56rpx;
  169. background-color: #fff;
  170. border-radius: 32rpx;
  171. .account-text {
  172. font-size: 32rpx;
  173. font-weight: 500;
  174. color: #2C2B28;
  175. line-height: 14rpx;
  176. margin-bottom: 40rpx;
  177. }
  178. .account-name {
  179. color: #2C2B28;
  180. font-weight: bold;
  181. font-size: 56rpx;
  182. line-height: 32rpx;
  183. }
  184. }
  185. .tip{
  186. font-size: 24rpx;
  187. color: #8B8B8B;
  188. margin-top: 16rpx;
  189. margin-left: 46rpx;
  190. text{
  191. margin-left: 6rpx;
  192. }
  193. }
  194. .list-title {
  195. color: #363531;
  196. font-weight: bold;
  197. font-size: 36rpx;
  198. line-height: 36rpx;
  199. margin: 48rpx 0 32rpx;
  200. .title-line {
  201. width: 8rpx;
  202. height: 32rpx;
  203. background-color: #FF8800;
  204. margin-right: 10rpx;
  205. }
  206. }
  207. .order-info {
  208. background-color: #fff;
  209. border-radius: 32rpx;
  210. .info-top {
  211. padding: 40rpx;
  212. border-bottom: 1rpx solid #E8E8E8;
  213. }
  214. .top-nums {
  215. font-weight: bold;
  216. color: #2C2B28;
  217. .yxb-num {
  218. font-size: 48rpx;
  219. margin-right: 8rpx;
  220. }
  221. .yxb-text {
  222. font-size: 24rpx;
  223. color: #564C47;
  224. }
  225. .price-num {
  226. font-size: 48rpx;
  227. }
  228. .price-text {
  229. font-size: 28rpx;
  230. }
  231. }
  232. .info-msg {
  233. margin-top: 32rpx;
  234. font-size: 32rpx;
  235. color: #2C2B28;
  236. font-weight: bold;
  237. white-space: nowrap;
  238. .msg-left {
  239. width: calc(100% - 142rpx);
  240. display: flex;
  241. align-items: center;
  242. font-weight: bold;
  243. font-size: 28rpx;
  244. .game-num{
  245. font-weight: bold;
  246. }
  247. }
  248. .red {
  249. display: flex;
  250. align-items: center;
  251. .red-box {
  252. display: flex;
  253. align-items: center;
  254. }
  255. }
  256. .og {
  257. color: #FF7C00;
  258. }
  259. .time-text {
  260. font-size: 24rpx;
  261. color: #564C47;
  262. font-weight: normal;
  263. }
  264. .zeng {
  265. flex-shrink: 0;
  266. display: inline-block;
  267. background-color: #5CB020;
  268. width: 40rpx;
  269. height: 32rpx;
  270. line-height: 32rpx;
  271. color: #fff;
  272. font-size: 24rpx;
  273. border-radius: 8rpx;
  274. text-align: center;
  275. font-weight: normal;
  276. margin-right: 6rpx;
  277. }
  278. .show {
  279. display: inline-block;
  280. vertical-align: middle;
  281. }
  282. .hide {
  283. display: none;
  284. }
  285. }
  286. }
  287. // .info-msg {
  288. // margin-top: 16rpx;
  289. // font-size: 16rpx;
  290. // color: #2C2B28;
  291. // font-weight: bold;
  292. // .msg-left {
  293. // width: calc(100% - 150rpx);
  294. // display: flex;
  295. // align-items: center;
  296. // font-weight: normal;
  297. // font-size: 12rpx;
  298. // }
  299. // .red {
  300. // display: flex;
  301. // align-items: center;
  302. // .red-box {
  303. // display: flex;
  304. // align-items: center;
  305. // }
  306. // }
  307. // .og {
  308. // color: #FF7C00;
  309. // }
  310. // .time-text {
  311. // font-size: 12rpx;
  312. // color: #564C47;
  313. // font-weight: normal;
  314. // }
  315. // .zeng {
  316. // display: inline-block;
  317. // background-color: #5CB020;
  318. // width: 20rpx;
  319. // height: 16rpx;
  320. // line-height: 16rpx;
  321. // color: #fff;
  322. // font-size: 12rpx;
  323. // border-radius: 4rpx;
  324. // text-align: center;
  325. // font-weight: normal;
  326. // margin-right: 3rpx;
  327. // }
  328. // .show {
  329. // display: inline-block;
  330. // vertical-align: middle;
  331. // }
  332. // .hide {
  333. // display: none;
  334. // }
  335. // }
  336. .info-btm {
  337. padding: 40rpx;
  338. font-size: 32rpx;
  339. color: #2C2B28;
  340. font-weight: 500;
  341. .date-wrapper{
  342. }
  343. .wx-ctrl{
  344. margin-top: 78rpx;
  345. .check-icon1-i{
  346. width: 48rpx;
  347. height: 48rpx;
  348. }
  349. }
  350. .margin-top-40 {
  351. margin-top: 40rpx;
  352. }
  353. .margin-top-30 {
  354. margin-top: 30rpx;
  355. }
  356. .margin-top-20 {
  357. margin-top: 20rpx;
  358. }
  359. img {
  360. width: 24rpx;
  361. height: 24rpx;
  362. }
  363. .img-1 {
  364. margin-right: 16rpx;
  365. }
  366. .img-4 {
  367. margin-right: 16rpx;
  368. }
  369. .img-3 {
  370. margin-right: 16rpx;
  371. transform: scale(0.9);
  372. }
  373. .check-icon {
  374. width: 40rpx;
  375. height: 40rpx;
  376. border: 1rpx solid #bbb;
  377. border-radius: 100%;
  378. margin-right: 2rpx;
  379. }
  380. .jbp {
  381. padding: 10rpx 0rpx 10rpx 0rpx;
  382. border-bottom: 1rpx solid #E8E8E8;
  383. }
  384. .dikou {
  385. // height: 42rpx;
  386. // float:left;
  387. // position:absolute;
  388. // margin-top: 70rpx;
  389. margin-left: 30rpx;
  390. .gongyou {
  391. font-weight: normal;
  392. font-size: 28px;
  393. color: #8B8B8B;
  394. }
  395. .kedi {
  396. font-weight: normal;
  397. font-size: 28px;
  398. color: #FF7C00;
  399. }
  400. }
  401. }
  402. .btn-wrapper {
  403. position: fixed;
  404. left: 0;
  405. bottom: 0;
  406. right: 0;
  407. padding: 24rpx 32rpx 0;
  408. z-index: 200;
  409. background-color: rgb(252, 252, 252);
  410. border-top: 1rpx solid #eee;
  411. box-shadow: 0rpx -4rpx 8rpx 0rpx rgba(109,84,52,0.19);
  412. .btn-price-text1 {
  413. color: #2C2B28;
  414. font-size: 32rpx;
  415. font-weight: bold;
  416. }
  417. .btn-price-text2 {
  418. color: #FF6400;
  419. font-size: 32rpx;
  420. font-weight: bold;
  421. }
  422. .btn-price-num {
  423. font-size: 48rpx;
  424. color: #FF6400;
  425. font-weight: bold;
  426. }
  427. .fx-icon {
  428. font-size: 32rpx;
  429. margin-right: 12rpx;
  430. &.check-icon1 {
  431. color: #281A13;
  432. }
  433. &.check-icon2 {
  434. color: #0087fb;
  435. }
  436. &.check-icon3 {
  437. color: #0087fb;
  438. }
  439. }
  440. .check-text {
  441. color: #281A13;
  442. font-size: 24rpx;
  443. .red {
  444. color: #FF6400;
  445. }
  446. }
  447. .btns{
  448. margin: 24rpx 0 8rpx;
  449. }
  450. .primary-btn {
  451. width: 296rpx;
  452. height: 96rpx;
  453. font-size: 36rpx;
  454. color: #FFFFFF;
  455. background: linear-gradient(140deg, #FF8500 0%, #FFA600 100%);
  456. border-radius: 48rpx;
  457. font-weight: bold;
  458. margin: 0;
  459. }
  460. }
  461. }
  462. </style>