Payment.vue 8.1 KB

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