timesPay.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. <template>
  2. <view class=" ">
  3. <view class="font header">
  4. 价格:{{price}}元/次
  5. </view>
  6. <view class="font header">
  7. <view class="font">
  8. 你要购买的数量:
  9. </view>
  10. <view class="input-two">
  11. <input type="text" class="input" v-model="num" />
  12. </view>
  13. <view class="font3">
  14. </view>
  15. </view>
  16. <view class="font2 header">
  17. 合计:{{num*price}}元
  18. </view>
  19. <view class="button">
  20. <button type="primary" @click="buy()" class="button2">
  21. <p class="p">购买</p>
  22. </button>
  23. </view>
  24. <font class="font1">{{title}}</font>
  25. <view class="" style="margin: auto;">
  26. <image class="" :src=img mode=""></image>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import {
  32. mapState,
  33. mapActions,
  34. mapMutations
  35. } from 'vuex'
  36. export default {
  37. data() {
  38. return {
  39. price:'',
  40. num:'10',
  41. title:'',
  42. img:null
  43. }
  44. },
  45. onLoad() {
  46. },
  47. onShow() {
  48. this.findPrice();
  49. },
  50. methods: {
  51. ...mapActions('chart', ['getPrice','pay']),
  52. findPrice(){
  53. var name = "timesPay";
  54. this.getPrice(name)
  55. .then(data => {
  56. this.price = data;
  57. }, _ => void uni.stopPullDownRefresh());
  58. },
  59. buy(){
  60. var p = this.price;
  61. var n = this.num;
  62. var pri = p*n;
  63. if(pri==0){
  64. uni.showModal({
  65. content: '请选择数量',
  66. showCancel: false
  67. });
  68. return null;
  69. }
  70. const param = {};
  71. param['price'] = pri;
  72. param['type'] = "1";
  73. param['equipmentId'] = uni.getStorageSync("nowEquipmentId");
  74. param['adminId'] = uni.getStorageSync("globalUser").id;
  75. this.pay(param).then(data => {
  76. this.title = "请用微信扫码支付";
  77. this.img = data;
  78. }, _ => void uni.stopPullDownRefresh());
  79. }
  80. },
  81. }
  82. </script>
  83. <style>
  84. .header {
  85. display: flex;
  86. flex-direction: row;
  87. justify-content: flex-start;
  88. padding-left: 20upx;
  89. }
  90. .font{
  91. padding-top: 20upx;
  92. height: 70upx;
  93. color: #363D44;
  94. font-size: 36upx;
  95. font-family: "PingFang-SC-Bold";
  96. }
  97. .font2{
  98. padding-top: 40upx;
  99. padding-bottom: 30upx;
  100. height: 70upx;
  101. color: #363D44;
  102. font-size: 36upx;
  103. font-family: "PingFang-SC-Bold";
  104. }
  105. .font3{
  106. padding-left: 30upx;
  107. padding-top: 23upx;
  108. height: 70upx;
  109. color: #363D44;
  110. font-size: 36upx;
  111. font-family: "PingFang-SC-Bold";
  112. }
  113. .input-two {
  114. width: 80upx;
  115. height: 30upx;
  116. padding-top: 23upx;
  117. padding-left: 30upx;
  118. }
  119. .input {
  120. padding-left: 20upx;
  121. background-color: #FFFFFF;
  122. width: 80upx;
  123. height: 30upx;
  124. box-shadow: 0upx 0upx 20upx #D3D3D3;
  125. border-radius: 5upx;
  126. }
  127. .button{
  128. padding-top: 70upx;
  129. margin: auto;
  130. width: 80%;
  131. height: 100upx;
  132. }
  133. .button2{
  134. margin: auto;
  135. width: 80%;
  136. height: 100upx;
  137. }
  138. .p{
  139. padding-top: 2upx;
  140. margin: 0 auto;
  141. font-size: 45upx;
  142. font-family: "PingFang-SC-Bold";
  143. }
  144. .font1{
  145. color: #F4AE1B;
  146. padding-left: 300upx;
  147. padding-top: 100upx;
  148. font-size: 25upx;
  149. font-family: "PingFang-SC-Bold";
  150. }
  151. .img{
  152. height: 600upx;
  153. weight:600upx;
  154. margin: auto;
  155. }
  156. </style>