_id.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  1. <template>
  2. <div class="point-pay">
  3. <div class="product">
  4. <div class="img">
  5. <img :src="ware.waresPic" alt="" />
  6. </div>
  7. <div class="content">
  8. <div class="title">{{ware.waresName}}</div>
  9. <div class="amount">
  10. <span class="text">积分 {{ware.saleIntegral}}</span> <span class="num">x 1</span>
  11. </div>
  12. </div>
  13. </div>
  14. <div class="have">
  15. <span class="icon1"></span>
  16. <span class="text">当前可用积分余额 {{pointInfo.points}}</span>
  17. <span class="icon2"></span>
  18. </div>
  19. <div class="total">
  20. <div class="text">合计:<span class="num">{{ware.saleIntegral}}积分</span></div>
  21. <button @click="pay">提交订单</button>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import ProductList from "../../../components/ProductList";
  27. import { mapState, mapGetters, mapActions } from "vuex";
  28. export default {
  29. validate({ params }) {
  30. return /^\d{1,}$/.test(params.id);
  31. },
  32. head() {
  33. return {
  34. title: "积分兑换确认",
  35. };
  36. },
  37. data() {
  38. return {
  39. id: this.$route.params.id,
  40. images: [],
  41. list: [],
  42. loading: false, //加载状态
  43. finished: false, //是否完成加载
  44. refreshing: false, //是否正在上拉刷新
  45. img: "/test/pro.png",
  46. };
  47. },
  48. computed: {
  49. ...mapState({
  50. pointInfo: (state) => state.point.pointInfo,
  51. userInfo:(state) => state.authen.userInfo
  52. }),
  53. ...mapGetters({
  54. userInfo: "authen/userInfo",
  55. findWare: "point/findWare",
  56. }),
  57. ware() {
  58. console.log("ware");
  59. return this.findWare(this.id)
  60. }
  61. },
  62. components: {
  63. ProductList,
  64. },
  65. mounted() {
  66. console.log(this);
  67. },
  68. methods: {
  69. pay(){
  70. this.$axios.$post("insertIntegralOrder",{
  71. "waresId":this.id,
  72. "waresName":this.ware.waresName,
  73. "openId":this.openId,
  74. "unionId":this.unionId,
  75. "customerName":this.userInfo.nickname,
  76. "exchangeNum":1,
  77. "integral":this.ware.saleIntegral,
  78. "stationId":this.stationId
  79. }).then((res)=>{
  80. this.$router.push({
  81. path:"/point/success"
  82. })
  83. })
  84. }
  85. },
  86. };
  87. </script>
  88. <style>
  89. .point-pay {
  90. width: 100%;
  91. background: #f8f8f8;
  92. }
  93. .point-pay .product {
  94. height: 1.82rem;
  95. background: #ffffff;
  96. box-sizing: border-box;
  97. padding: 0.3rem;
  98. display: flex;
  99. justify-content: center;
  100. align-items: center;
  101. }
  102. .point-pay .product .img {
  103. width: 2rem;
  104. height: 1.22rem;
  105. box-sizing: border-box;
  106. padding: 0.2rem;
  107. }
  108. .point-pay .product .img img {
  109. width: 100%;
  110. height: 100%;
  111. }
  112. .point-pay .product .content {
  113. width: 5.9rem;
  114. }
  115. .point-pay .product .content .title {
  116. display: block;
  117. height: 0.45rem;
  118. font-size: 0.32rem;
  119. font-family: PingFangSC-Regular, PingFang SC;
  120. font-weight: 400;
  121. color: #0f0f0f;
  122. line-height: 0.45rem;
  123. }
  124. .point-pay .product .content .amount {
  125. display: flex;
  126. justify-content: space-between;
  127. }
  128. .point-pay .product .content .amount .text {
  129. height: 0.4rem;
  130. font-size: 0.28rem;
  131. font-family: PingFangSC-Regular, PingFang SC;
  132. font-weight: 400;
  133. color: #666666;
  134. line-height: 0.4rem;
  135. }
  136. .point-pay .product .content .amount .num {
  137. height: 0.4rem;
  138. font-size: 0.28rem;
  139. font-family: PingFangSC-Regular, PingFang SC;
  140. font-weight: 400;
  141. color: #666666;
  142. line-height: 0.4rem;
  143. }
  144. .point-pay .have {
  145. margin-top: 0.22rem;
  146. height: 1.1rem;
  147. background: #ffffff;
  148. position: relative;
  149. }
  150. .point-pay .have .icon1 {
  151. display: inline-block;
  152. width: 0.4rem;
  153. height: 0.35rem;
  154. background: url("../../../static/point/jifen@2x.png") no-repeat 0 0;
  155. background-size: 100% 100%;
  156. position: absolute;
  157. top: 0.39rem;
  158. left: 0.3rem;
  159. }
  160. .point-pay .have .text {
  161. height: 1.1rem;
  162. font-size: 0.28rem;
  163. font-family: PingFangSC-Regular, PingFang SC;
  164. font-weight: 400;
  165. color: #090909;
  166. line-height: 1.1rem;
  167. position: absolute;
  168. left: 0.99rem;
  169. }
  170. .point-pay .have .icon2 {
  171. display: inline-block;
  172. width: 0.36rem;
  173. height: 0.36rem;
  174. background: url("../../../static/point/xuanzhong@2x.png") no-repeat 0 0;
  175. background-size: 100% 100%;
  176. position: absolute;
  177. right: 0.36rem;
  178. top: 0.36rem;
  179. }
  180. .point-pay .total {
  181. width: 7.5rem;
  182. height: 1.98rem;
  183. background: #ffffff;
  184. opacity: 0.95;
  185. position: fixed;
  186. bottom: 0;
  187. left: 0;
  188. right: 0;
  189. display: flex;
  190. justify-content: flex-end;
  191. box-sizing: border-box;
  192. padding: 0.4rem;
  193. align-items: center;
  194. }
  195. .point-pay .total .text {
  196. font-size: 0.28rem;
  197. font-family: PingFangSC-Regular, PingFang SC;
  198. font-weight: 400;
  199. color: #111111;
  200. line-height: 0.4rem;
  201. }
  202. .point-pay .total .text .num {
  203. width: 1.17rem;
  204. height: 0.62rem;
  205. font-size: 0.44rem;
  206. font-family: PingFangSC-Regular, PingFang SC;
  207. font-weight: 400;
  208. color: #111111;
  209. line-height: 0.62rem;
  210. }
  211. .point-pay .total button {
  212. border: none;
  213. background-color: transparent;
  214. outline: none;
  215. display: block;
  216. width: 2.2rem;
  217. height: 0.8rem;
  218. background: #fe9700;
  219. border-radius: 0.45rem;
  220. font-size: 0.28rem;
  221. font-family: PingFangSC-Regular, PingFang SC;
  222. font-weight: 400;
  223. color: #ffffff;
  224. line-height: 0.4rem;
  225. margin-left: 0.2rem;
  226. }
  227. </style>