_id.vue 5.2 KB

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