Payment.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <!-- 支付 -->
  3. <div class="Nopyment" v-loading="loading">
  4. <div class="message">
  5. <div>
  6. <img :src="data.picture_url" alt="" />
  7. </div>
  8. <div class="text">
  9. <p class="p1">
  10. {{ data.name }}
  11. </p>
  12. <p class="p2">
  13. <span>xx课程</span>
  14. </p>
  15. <p class="p3">{{ data.author }}</p>
  16. </div>
  17. <div class="price">
  18. <p>¥{{ data.price }}</p>
  19. </div>
  20. </div>
  21. <div class="pay-platform">
  22. <p class="pay-platform-title">选择支付平台</p>
  23. <ul class="pay-platform-list">
  24. <li
  25. :class="item.isSelected ? 'active' : ''"
  26. v-for="(item, index) in platList"
  27. :key="'plat' + index"
  28. >
  29. <img :src="item.img" class="plat-logo" />
  30. <img src="../../assets/pay/active.png" class="active-icon" />
  31. </li>
  32. </ul>
  33. </div>
  34. <div class="total">
  35. <p class="p1">
  36. <span> 一件商品,总金额: </span>
  37. <span class="co-value">¥{{ data.price }}</span>
  38. </p>
  39. <p class="p2">
  40. <span> 优惠折扣: </span>
  41. <span class="co-value">-¥{{ data.discount_money }}</span>
  42. </p>
  43. <p class="p4">
  44. <span></span>
  45. <span class="co-value useCode">
  46. {{
  47. data.back_discount_code ? data.back_discount_code : "没使用优惠码"
  48. }}
  49. </span>
  50. </p>
  51. <p class="p3">
  52. <span> 应付: </span>
  53. <span class="co-value">¥{{ data.receivables_money }}</span>
  54. </p>
  55. </div>
  56. <div class="submitBtn">
  57. <button @click="buy(data)">去支付</button>
  58. </div>
  59. </div>
  60. </template>
  61. <script>
  62. //这里可以导入其它文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  63. //例如:import 《组件名称》from ‘《组件路径》';
  64. import { LearnWebSI } from "@/api/ajax";
  65. export default {
  66. //import引入的组件需要注入到对象中才能使用
  67. components: {},
  68. props: ["data", "orderNumber", "closePyment"],
  69. data() {
  70. //这里存放数据
  71. return {
  72. loading: false,
  73. platList: [
  74. {
  75. img: require("../../assets/pay/shouxinyi.png"),
  76. isSelected: true,
  77. },
  78. ],
  79. };
  80. },
  81. //计算属性 类似于data概念
  82. computed: {},
  83. //监控data中数据变化
  84. watch: {},
  85. //方法集合
  86. methods: {
  87. // 购买
  88. buy(item) {
  89. this.loading = true;
  90. // 首先添加订单
  91. let Mnam = "order-order_manager-PayMyOrder";
  92. LearnWebSI(Mnam, {
  93. id: this.orderNumber, //订单id
  94. pay_money: item.price, //支付金额
  95. bank_transaction_sn: "", //银行交易流水号
  96. })
  97. .then((res) => {
  98. console.log(res);
  99. window.location.href = res.pay_page_url;
  100. // this.$message({
  101. // type: "success",
  102. // message: "支付成功",
  103. // });
  104. // this.closePyment("支付成功");
  105. // this.loading = false;
  106. // 调取支付接口
  107. })
  108. .catch((res) => {
  109. this.loading = false;
  110. });
  111. },
  112. },
  113. //生命周期 - 创建完成(可以访问当前this实例)
  114. created() {},
  115. //生命周期 - 挂载完成(可以访问DOM元素)
  116. mounted() {},
  117. //生命周期-创建之前
  118. beforeCreated() {},
  119. //生命周期-挂载之前
  120. beforeMount() {},
  121. //生命周期-更新之前
  122. beforUpdate() {},
  123. //生命周期-更新之后
  124. updated() {},
  125. //生命周期-销毁之前
  126. beforeDestory() {},
  127. //生命周期-销毁完成
  128. destoryed() {},
  129. //如果页面有keep-alive缓存功能,这个函数会触发
  130. activated() {},
  131. };
  132. </script>
  133. <style lang="scss" scoped>
  134. /* @import url(); 引入css类 */
  135. .Nopyment {
  136. .pay-platform {
  137. width: 656px;
  138. box-sizing: border-box;
  139. padding: 16px 0 16px;
  140. border-top: 1px rgba(44, 44, 44, 0.15) solid;
  141. border-bottom: 1px rgba(44, 44, 44, 0.15) solid;
  142. &-title {
  143. padding: 0;
  144. margin: 0;
  145. font-style: normal;
  146. font-weight: normal;
  147. font-size: 16px;
  148. line-height: 150%;
  149. color: #000000;
  150. margin-bottom: 16px;
  151. }
  152. &-list {
  153. display: flex;
  154. flex-wrap: wrap;
  155. margin: 0;
  156. padding: 0;
  157. > li {
  158. position: relative;
  159. display: flex;
  160. justify-content: center;
  161. align-items: center;
  162. width: 152px;
  163. height: 60px;
  164. background: #ffffff;
  165. border: 1px solid rgba(44, 44, 44, 0.15);
  166. box-sizing: border-box;
  167. border-radius: 4px;
  168. cursor: pointer;
  169. margin: 0 8px 8px 0;
  170. > .plat-logo {
  171. width: 99px;
  172. height: 26px;
  173. }
  174. > .active-icon {
  175. position: absolute;
  176. bottom: -1px;
  177. right: -1px;
  178. width: 20px;
  179. height: 20px;
  180. display: block;
  181. }
  182. &.active {
  183. border-color: #ff9900;
  184. }
  185. }
  186. }
  187. }
  188. .message {
  189. width: 656px;
  190. height: 152px;
  191. background: rgba(70, 70, 70, 0.03);
  192. border-radius: 8px;
  193. display: flex;
  194. margin-bottom: 24px;
  195. img {
  196. width: 120px;
  197. height: 120px;
  198. margin-left: 16px;
  199. margin-top: 16px;
  200. }
  201. .text {
  202. margin-left: 24px;
  203. .p1 {
  204. width: 360px;
  205. // height: 45px;
  206. max-height: 48px;
  207. font-size: 16px;
  208. line-height: 20px;
  209. color: #2c2c2c;
  210. margin-top: 22px;
  211. word-break: break-all;
  212. display: -webkit-box;
  213. -webkit-box-orient: vertical;
  214. -webkit-line-clamp: 2;
  215. text-overflow: ellipsis;
  216. overflow: hidden;
  217. }
  218. .p2 {
  219. margin-top: 10px;
  220. span {
  221. width: 64px;
  222. height: 24px;
  223. background: #ffefd8;
  224. border-radius: 4px;
  225. font-weight: bold;
  226. font-size: 12px;
  227. text-align: center;
  228. color: #ff9900;
  229. line-height: 24px;
  230. padding: 2px 8px;
  231. }
  232. }
  233. .p3 {
  234. margin-top: 10px;
  235. }
  236. }
  237. .price {
  238. p {
  239. margin-left: 67px;
  240. margin-top: 22px;
  241. font-weight: bold;
  242. font-size: 16px;
  243. text-align: right;
  244. color: #ff4c00;
  245. }
  246. }
  247. }
  248. .promotionCode {
  249. display: flex;
  250. justify-content: flex-start;
  251. align-self: center;
  252. width: 100%;
  253. margin-top: 24px;
  254. height: 58px;
  255. line-height: 56px;
  256. border-top: 1px solid rgba(44, 44, 44, 0.15);
  257. border-bottom: 1px solid rgba(44, 44, 44, 0.15);
  258. .sp1 {
  259. font-size: 16px;
  260. color: #000000;
  261. }
  262. input {
  263. padding: 0 24px;
  264. flex: 1;
  265. height: 56px;
  266. outline: none;
  267. border: none;
  268. box-sizing: border-box;
  269. }
  270. .sp2 {
  271. cursor: pointer;
  272. font-size: 16px;
  273. color: #ff9900;
  274. }
  275. }
  276. .total {
  277. width: 656px;
  278. text-align: right;
  279. color: #000000;
  280. font-size: 16px;
  281. padding-top: 24px;
  282. .useCode {
  283. font-size: 12px;
  284. color: rgba(0, 0, 0, 0.5);
  285. }
  286. > p {
  287. > span {
  288. display: inline-block;
  289. }
  290. .co-value {
  291. width: 160px;
  292. }
  293. }
  294. .p1 {
  295. > span {
  296. display: inline-block;
  297. line-height: 24px;
  298. }
  299. }
  300. .p2 {
  301. margin: 16px 0 10px;
  302. }
  303. .p3 {
  304. > span {
  305. line-height: 36px;
  306. }
  307. .co-value {
  308. font-size: 24px;
  309. color: #ff4c00;
  310. }
  311. }
  312. }
  313. .submitBtn {
  314. text-align: right;
  315. margin-top: 16px;
  316. button {
  317. width: 120px;
  318. height: 40px;
  319. background: #ff4d00;
  320. border-radius: 4px;
  321. color: white;
  322. line-height: 40px;
  323. text-align: center;
  324. border: none;
  325. outline: none;
  326. cursor: pointer;
  327. }
  328. }
  329. }
  330. </style>
  331. <style lang="scss">
  332. </style>