_id.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. console.log("this.userInfo",this.userInfo)
  72. console.log(this.userInfo);
  73. this.$axios
  74. .$post("insertIntegralOrder", {
  75. waresId: this.id,
  76. waresName: this.ware.waresName,
  77. openId: this.openId,
  78. unionId: this.unionId,
  79. customerName: this.userInfo.nickname,
  80. exchangeNum: 1,
  81. integral: this.ware.saleIntegral,
  82. stationId: this.stationId,
  83. })
  84. .then((res) => {
  85. console.log(res);
  86. if (res.retCode === 0) {
  87. this.$router.push({
  88. path: "/point/success",
  89. });
  90. }else{
  91. alert("兑换失败")
  92. }
  93. });
  94. },
  95. },
  96. };
  97. </script>
  98. <style>
  99. .point-pay {
  100. width: 100%;
  101. background: #f8f8f8;
  102. }
  103. .point-pay .product {
  104. height: 1.82rem;
  105. background: #ffffff;
  106. box-sizing: border-box;
  107. padding: 0.3rem;
  108. display: flex;
  109. justify-content: center;
  110. align-items: center;
  111. }
  112. .point-pay .product .img {
  113. width: 2rem;
  114. height: 1.22rem;
  115. box-sizing: border-box;
  116. padding: 0.2rem;
  117. }
  118. .point-pay .product .img img {
  119. width: 100%;
  120. height: 100%;
  121. }
  122. .point-pay .product .content {
  123. width: 5.9rem;
  124. }
  125. .point-pay .product .content .title {
  126. display: block;
  127. height: 0.45rem;
  128. font-size: 0.32rem;
  129. font-family: PingFangSC-Regular, PingFang SC;
  130. font-weight: 400;
  131. color: #0f0f0f;
  132. line-height: 0.45rem;
  133. }
  134. .point-pay .product .content .amount {
  135. display: flex;
  136. justify-content: space-between;
  137. }
  138. .point-pay .product .content .amount .text {
  139. height: 0.4rem;
  140. font-size: 0.28rem;
  141. font-family: PingFangSC-Regular, PingFang SC;
  142. font-weight: 400;
  143. color: #666666;
  144. line-height: 0.4rem;
  145. }
  146. .point-pay .product .content .amount .num {
  147. height: 0.4rem;
  148. font-size: 0.28rem;
  149. font-family: PingFangSC-Regular, PingFang SC;
  150. font-weight: 400;
  151. color: #666666;
  152. line-height: 0.4rem;
  153. }
  154. .point-pay .have {
  155. margin-top: 0.22rem;
  156. height: 1.1rem;
  157. background: #ffffff;
  158. position: relative;
  159. }
  160. .point-pay .have .icon1 {
  161. display: inline-block;
  162. width: 0.4rem;
  163. height: 0.35rem;
  164. background: url("../../../static/point/jifen@2x.png") no-repeat 0 0;
  165. background-size: 100% 100%;
  166. position: absolute;
  167. top: 0.39rem;
  168. left: 0.3rem;
  169. }
  170. .point-pay .have .text {
  171. height: 1.1rem;
  172. font-size: 0.28rem;
  173. font-family: PingFangSC-Regular, PingFang SC;
  174. font-weight: 400;
  175. color: #090909;
  176. line-height: 1.1rem;
  177. position: absolute;
  178. left: 0.99rem;
  179. }
  180. .point-pay .have .icon2 {
  181. display: inline-block;
  182. width: 0.36rem;
  183. height: 0.36rem;
  184. background: url("../../../static/point/xuanzhong@2x.png") no-repeat 0 0;
  185. background-size: 100% 100%;
  186. position: absolute;
  187. right: 0.36rem;
  188. top: 0.36rem;
  189. }
  190. .point-pay .total {
  191. width: 7.5rem;
  192. height: 1.98rem;
  193. background: #ffffff;
  194. opacity: 0.95;
  195. position: fixed;
  196. bottom: 0;
  197. left: 0;
  198. right: 0;
  199. display: flex;
  200. justify-content: flex-end;
  201. box-sizing: border-box;
  202. padding: 0.4rem;
  203. align-items: center;
  204. }
  205. .point-pay .total .text {
  206. font-size: 0.28rem;
  207. font-family: PingFangSC-Regular, PingFang SC;
  208. font-weight: 400;
  209. color: #111111;
  210. line-height: 0.4rem;
  211. }
  212. .point-pay .total .text .num {
  213. width: 1.17rem;
  214. height: 0.62rem;
  215. font-size: 0.44rem;
  216. font-family: PingFangSC-Regular, PingFang SC;
  217. font-weight: 400;
  218. color: #111111;
  219. line-height: 0.62rem;
  220. }
  221. .point-pay .total button {
  222. border: none;
  223. background-color: transparent;
  224. outline: none;
  225. display: block;
  226. width: 2.2rem;
  227. height: 0.8rem;
  228. background: #fe9700;
  229. border-radius: 0.45rem;
  230. font-size: 0.28rem;
  231. font-family: PingFangSC-Regular, PingFang SC;
  232. font-weight: 400;
  233. color: #ffffff;
  234. line-height: 0.4rem;
  235. margin-left: 0.2rem;
  236. }
  237. </style>