paymentOrder.vue 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044
  1. <template>
  2. <view class="content">
  3. <u-navbar title="去支付" :autoBack="true"> </u-navbar>
  4. <view class="inner" v-if="order">
  5. <!-- 时间、价格 -->
  6. <view class="time-price">
  7. <text class="time">请在{{payLimitTime}}前完成支付</text>
  8. <view class="price-box">
  9. <text class="unit">¥</text>
  10. <text class="num">{{payMoney.toFixed(2)}}</text>
  11. </view>
  12. <text class="desc" v-if="payType==2">代收金额{{payDelivery.toFixed(2)}},请您在收到快递后支付尾款给快递人员。</text>
  13. <text class="desc" v-if="payType==3">货到付款金额{{payDelivery.toFixed(2)}},请您在收到快递后支付给快递人员。</text>
  14. </view>
  15. <!-- 支付方式 -->
  16. <view class="pay-type">
  17. <view class="title">支付方式</view>
  18. <!-- 改价订单只能选择微信支付和物流代收 -->
  19. <radio-group @change="payTypeChange" v-if="order.isEditMoney!=null&&order.isEditMoney==1">
  20. <view class="item">
  21. <view class="left">
  22. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/wecha_pay.png"
  23. mode=""></image>
  24. <text class="text">微信支付</text>
  25. </view>
  26. <label>
  27. <radio :value="1" :checked="order.payType=='1'" />
  28. </label>
  29. </view>
  30. <view class="item">
  31. <view class="left">
  32. <image src="/static/images/zfb.png" mode=""></image>
  33. <text class="text">支付宝支付</text>
  34. </view>
  35. <label>
  36. <radio :value="99" :checked="order.payType=='99'" />
  37. </label>
  38. </view>
  39. <view class="item">
  40. <view class="left">
  41. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/pay_de.png" mode="">
  42. </image>
  43. <text class="text">物流代收</text>
  44. </view>
  45. <label>
  46. <radio :value="2" :checked="order.payType=='2'" />
  47. </label>
  48. </view>
  49. </radio-group>
  50. <radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==3">
  51. <view class="item">
  52. <view class="left">
  53. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/wecha_pay.png"
  54. mode=""></image>
  55. <text class="text">微信支付</text>
  56. </view>
  57. <label>
  58. <radio :value="1" :checked="order.payType=='1'" />
  59. </label>
  60. </view>
  61. <view class="item">
  62. <view class="left">
  63. <image src="/static/images/zfb.png" mode=""></image>
  64. <text class="text">支付宝支付</text>
  65. </view>
  66. <label>
  67. <radio :value="99" :checked="order.payType=='99'" />
  68. </label>
  69. </view>
  70. <view class="item">
  71. <view class="left">
  72. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/pay_de.png" mode="">
  73. </image>
  74. <text class="text">物流代收</text>
  75. </view>
  76. <label>
  77. <radio :value="2" :checked="order.payType=='2'" />
  78. </label>
  79. </view>
  80. <!-- <view class="item" v-if="user!=null&&user.level==1 "> -->
  81. <view class="item">
  82. <view class="left">
  83. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/pay_1.png" mode="">
  84. </image>
  85. <text class="text">货到付款</text>
  86. </view>
  87. <label>
  88. <radio :value="3" :checked="order.payType=='3'" />
  89. </label>
  90. </view>
  91. </radio-group>
  92. <radio-group @change="payTypeChange" v-else-if="order.orderCreateType!=null&& order.orderCreateType==2">
  93. <view class="item" v-if="payType==1||payType==4">
  94. <view class="left">
  95. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/wecha_pay.png"
  96. mode=""></image>
  97. <text class="text">微信支付</text>
  98. </view>
  99. <label>
  100. <radio :value="1" :checked="order.payType=='1'" />
  101. </label>
  102. </view>
  103. <view class="item">
  104. <view class="left">
  105. <image src="/static/images/zfb.png" mode=""></image>
  106. <text class="text">支付宝支付</text>
  107. </view>
  108. <label>
  109. <radio :value="99" :checked="order.payType=='99'" />
  110. </label>
  111. </view>
  112. <view class="item" v-if="payType==2||payType==4">
  113. <view class="left">
  114. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/pay_de.png" mode="">
  115. </image>
  116. <text class="text">物流代收</text>
  117. </view>
  118. <label>
  119. <radio :value="2" :checked="order.payType=='2'" />
  120. </label>
  121. </view>
  122. <!-- <view class="item" v-if="user!=null&&user.level==1 "> -->
  123. <view class="item" v-if="payType==1||payType==4">
  124. <view class="left">
  125. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/pay_1.png" mode="">
  126. </image>
  127. <text class="text">货到付款</text>
  128. </view>
  129. <label>
  130. <radio :value="3" :checked="order.payType=='3'" />
  131. </label>
  132. </view>
  133. </radio-group>
  134. <radio-group @change="payTypeChange"
  135. v-else-if="order.orderCreateType!=null&&(order.orderCreateType==1)">
  136. <view class="item">
  137. <view class="left">
  138. <image src="https://zkzh-2025.oss-cn-beijing.aliyuncs.com/shop/images/wecha_pay.png"
  139. mode=""></image>
  140. <text class="text">微信支付</text>
  141. </view>
  142. <label>
  143. <radio :value="1" checked />
  144. </label>
  145. </view>
  146. <!-- <view class="item">
  147. <view class="left">
  148. <image src="/static/images/zfb.png" mode=""></image>
  149. <text class="text">支付宝支付</text>
  150. </view>
  151. <label>
  152. <radio :value="99" :checked="order.payType=='99'" />
  153. </label>
  154. </view> -->
  155. </radio-group>
  156. </view>
  157. <!-- 订单详情查看 -->
  158. <view class="order-info">
  159. <view class="title">订单信息</view>
  160. <view class="item">
  161. <text class="label">订单编号</text>
  162. <view class="sn-box">
  163. <text class="text">{{order.orderCode}}</text>
  164. <view class="copy-btn" @click="copyOrderSn(order.orderCode)">复制</view>
  165. </view>
  166. </view>
  167. <view class="item">
  168. <text class="label">下单时间</text>
  169. <text class="text">{{order.createTime}}</text>
  170. </view>
  171. <view class="item">
  172. <text class="label">订单金额</text>
  173. <text class="text" v-if="order!=null">{{order.payPrice.toFixed(2)}}</text>
  174. </view>
  175. <!-- <view class="item">
  176. <text class="label">支付方式</text>
  177. <text class="text">微信支付</text>
  178. </view> -->
  179. </view>
  180. </view>
  181. <view class="btn-box">
  182. <view class="btn" @click="payOrder()">去支付</view>
  183. <!-- <view class="other-btn" >
  184. 亲友代付
  185. <button class="share" data-name="shareBtn" open-type="share">分享</button>
  186. </view> -->
  187. </view>
  188. <!-- <ykscreenRecord></ykscreenRecord> -->
  189. <uni-popup ref="popPayType" type="bottom" borderRadius="10rpx 10rpx 0px 0px">
  190. <view class="pay-box">
  191. <view class="title">请选择支付方式</view>
  192. <view class="pay-list">
  193. <!-- <view class="pay-item alipay" @click="doAlipay()">
  194. <image src="/static/images/alipay.png"></image>
  195. <view class="name">支付宝支付</view>
  196. </view> -->
  197. <view class="pay-item wx" @click="doWxPay()">
  198. <image src="/static/images/wx.png"></image>
  199. <view class="name">微信支付</view>
  200. </view>
  201. </view>
  202. </view>
  203. </uni-popup>
  204. <uni-popup ref="popTip" type="dialog">
  205. <uni-popup-dialog cancelText="支付失败" confirmText="支付成功" mode="base" content="是否已支付成功?" title="提示"
  206. :duration="2000" :before-close="true" @close="confirmTip" @confirm="confirmTip"></uni-popup-dialog>
  207. </uni-popup>
  208. </view>
  209. </template>
  210. <script>
  211. import {
  212. getUserInfo
  213. } from '@/api/user'
  214. import {
  215. getStoreConfig
  216. } from '@/api/common'
  217. import {
  218. editPayType,
  219. pay,
  220. getStoreOrderById,
  221. orderBindUser,
  222. aliPayment
  223. } from '@/api/storeOrder'
  224. import {
  225. H5WxPayment
  226. } from '@/api/packageOrder'
  227. import ykscreenRecord from "@/components/yk-screenRecord/yk-screenRecord.vue"
  228. export default {
  229. components: {
  230. ykscreenRecord
  231. },
  232. data() {
  233. return {
  234. orderId: null,
  235. payDelivery: 0,
  236. payMoney: 0,
  237. config: null,
  238. payType: 1,
  239. payLimitTime: null,
  240. order: null,
  241. user: null,
  242. }
  243. },
  244. onLoad(option) {
  245. // this.orderId = JSON.parse(option.orderId);
  246. this.orderId = option.orderId
  247. // this.orderBindUser(this.orderId)
  248. this.getStoreOrderById();
  249. this.getStoreConfig();
  250. this.getUserInfo();
  251. },
  252. methods: {
  253. payFun() {
  254. var data = {
  255. orderId: this.orderId
  256. };
  257. var that = this;
  258. uni.showLoading();
  259. getStoreOrderById(data).then(
  260. res => {
  261. this.$refs.popTip.close();
  262. uni.hideLoading();
  263. if (res.order.paid == 1) {
  264. uni.redirectTo({
  265. url: "/pages_user/user/storeOrderDetail?id=" + that.orderId
  266. })
  267. } else {
  268. uni.showToast({
  269. title: '未支付成功',
  270. icon: 'none'
  271. });
  272. }
  273. },
  274. rej => {}
  275. );
  276. },
  277. confirmTip() {
  278. uni.showLoading({
  279. title: "请稍侯...",
  280. mask: true
  281. });
  282. setTimeout(() => {
  283. uni.hideLoading();
  284. this.payFun();
  285. }, 2000);
  286. },
  287. doWxPay() {
  288. var that = this;
  289. var data = {
  290. orderId: this.orderId,
  291. };
  292. // #ifdef H5
  293. if (String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger") {
  294. uni.showLoading();
  295. H5WxPayment(data).then(
  296. res => {
  297. uni.hideLoading()
  298. if (res.code == 200) {
  299. if (res.type == "tz") {
  300. window.location.href = res.data.body.url
  301. // uni.setStorageSync("h5PayUrl",res.data.body.url);
  302. // console.log(res.data.body.url)
  303. // uni.redirectTo({
  304. // url:"/pages/store/payH5"
  305. // })
  306. } else if (res.type == 'hf') {
  307. var payObj = JSON.parse(res.data.pay_info);
  308. jweixin.config({
  309. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  310. appId: payObj.appId, // 必填,公众号的唯一标识
  311. timestamp: payObj.timeStamp, // 必填,生成签名的时间戳
  312. nonceStr: payObj.nonceStr, // 必填,生成签名的随机串
  313. signature: payObj.paySign, // 必填,签名
  314. jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表
  315. })
  316. jweixin.ready(function() {
  317. jweixin.chooseWXPay({
  318. timestamp: payObj.timeStamp, // 时间戳
  319. nonceStr: payObj.nonceStr, // 随机数
  320. package: payObj.package, //
  321. signType: payObj.signType,
  322. paySign: payObj.paySign, // 签名
  323. success: function() {
  324. uni.showToast({
  325. title: '支付成功'
  326. });
  327. setTimeout(() => {
  328. uni.navigateTo({
  329. url: `/pages/store/packageOrderPaySuccess?orderId=${that.orderId}`
  330. });
  331. }, 2000);
  332. },
  333. cancel: function() {
  334. uni.showToast({
  335. title: '取消支付',
  336. icon: 'none'
  337. });
  338. },
  339. fail: function(res) {
  340. uni.showToast({
  341. title: '支付失败' + JSON.stringify(res),
  342. icon: 'none'
  343. });
  344. }
  345. })
  346. })
  347. }
  348. } else {
  349. uni.showToast({
  350. icon: 'none',
  351. title: res.msg,
  352. });
  353. }
  354. },
  355. rej => {}
  356. );
  357. } else {
  358. uni.showToast({
  359. title: '请在微信内打开',
  360. icon: 'none'
  361. })
  362. }
  363. // #endif
  364. // #ifdef APP-PLUS
  365. plus.share.getServices(function(res) {
  366. var sweixin = null;
  367. for (var i = 0; i < res.length; i++) {
  368. var t = res[i];
  369. if (t.id == 'weixin') {
  370. sweixin = t;
  371. }
  372. }
  373. if (sweixin) {
  374. console.log('调起小程序')
  375. // that.$refs.popPayType.close()
  376. that.$refs.popTip.open()
  377. //唤起微信跳转小程序
  378. sweixin.launchMiniProgram({
  379. // id: "gh_0b4b9e32adba",
  380. id: getApp().globalData.miniprogamId,
  381. // path:'pages_order/packagePayment?orderId='+that.orderId+"&payMethod=app",
  382. path: 'pages/shopping/paymentOrder?orderId=' + that.orderId + "&payMethod=app",
  383. type: 0
  384. }, function() {
  385. console.log("微信唤起成功");
  386. return true;
  387. }, function(e) {
  388. console.log("微信唤起失败", e);
  389. uni.showToast({
  390. title: '微信唤起失败,请检查是否有微信应用',
  391. icon: 'none'
  392. })
  393. return false;
  394. })
  395. } else {
  396. uni.showToast({
  397. title: '微信唤起失败,请检查是否有微信应用',
  398. icon: 'none',
  399. duration: 3000
  400. });
  401. return false;
  402. }
  403. }, function(res) {
  404. console.log(JSON.stringify(res));
  405. });
  406. // #endif
  407. },
  408. orderBindUser(orderId) {
  409. uni.showLoading({
  410. title: '加载中...'
  411. })
  412. orderBindUser({
  413. orderId: orderId
  414. }).then(res => {
  415. uni.hideLoading()
  416. if (res.code == 200) {
  417. this.getStoreOrderById();
  418. this.getStoreConfig();
  419. this.getUserInfo();
  420. // uni.showShareMenu({
  421. // withShareTicket:true,
  422. // //小程序的原生菜单中显示分享按钮,才能够让发送给朋友与分享到朋友圈两个按钮可以点击
  423. // menus:["shareAppMessage"] //不设置默认发送给朋友
  424. // })
  425. } else {
  426. uni.showToast({
  427. icon: 'none',
  428. title: res.msg,
  429. });
  430. }
  431. }).catch(() => {
  432. uni.hideLoading()
  433. });
  434. },
  435. getUserInfo() {
  436. getUserInfo().then(
  437. res => {
  438. if (res.code == 200) {
  439. if (res.user != null) {
  440. this.user = res.user;
  441. }
  442. } else {
  443. uni.showToast({
  444. icon: 'none',
  445. title: "请求失败",
  446. });
  447. }
  448. },
  449. rej => {}
  450. );
  451. },
  452. getStoreConfig() {
  453. getStoreConfig().then(
  454. res => {
  455. if (res.code == 200) {
  456. this.config = res.data
  457. console.log(this.config);
  458. }
  459. },
  460. rej => {}
  461. );
  462. },
  463. payTypeChange(e) {
  464. this.editPayType(e.detail.value)
  465. },
  466. copyOrderSn(text) {
  467. // 复制方法
  468. uni.setClipboardData({
  469. data: text,
  470. success: () => {
  471. uni.showToast({
  472. title: '内容已成功复制到剪切板',
  473. icon: 'none'
  474. })
  475. }
  476. });
  477. },
  478. getStoreOrderById() {
  479. var data = {
  480. orderId: this.orderId
  481. };
  482. var that = this;
  483. uni.showLoading();
  484. getStoreOrderById(data).then(
  485. res => {
  486. if (res.code == 200) {
  487. console.log(res);
  488. uni.hideLoading();
  489. that.order = res.order;
  490. that.payLimitTime = res.payLimitTime;
  491. //套餐订单处理
  492. if (res.productPackage != null) {
  493. this.payType = res.productPackage.payType;
  494. console.log(this.payType)
  495. if (this.order.payType == 4) {
  496. this.order.payType = 1;
  497. }
  498. }
  499. this.editPayType(this.order.payType)
  500. } else {
  501. uni.showToast({
  502. icon: 'none',
  503. title: res.msg,
  504. });
  505. }
  506. },
  507. rej => {}
  508. );
  509. },
  510. editPayType(payType) {
  511. var data = {
  512. orderId: this.orderId,
  513. payType: payType
  514. };
  515. var that = this;
  516. uni.showLoading();
  517. editPayType(data).then(
  518. res => {
  519. if (res.code == 200) {
  520. console.log(res);
  521. uni.hideLoading();
  522. that.order = res.order;
  523. //this.payType=this.order.payType
  524. this.payMoney = this.order.payMoney;
  525. this.payDelivery = this.order.payDelivery;
  526. } else {
  527. uni.showToast({
  528. icon: 'none',
  529. title: res.msg,
  530. });
  531. }
  532. },
  533. rej => {}
  534. );
  535. },
  536. otherPayOrder() {
  537. uni.navigateTo({
  538. url: '/pages_user/user/otherPaymentOrder?orderId=' + this.orderId
  539. })
  540. },
  541. doWxPay() {
  542. var that = this;
  543. var data = {
  544. orderId: this.orderId,
  545. };
  546. // #ifdef H5
  547. if (String(navigator.userAgent.toLowerCase().match(/MicroMessenger/i)) === "micromessenger") {
  548. uni.showLoading();
  549. H5WxPayment(data).then(
  550. res => {
  551. uni.hideLoading()
  552. if (res.code == 200) {
  553. if (res.type == "tz") {
  554. window.location.href = res.data.body.url
  555. // uni.setStorageSync("h5PayUrl",res.data.body.url);
  556. // console.log(res.data.body.url)
  557. // uni.redirectTo({
  558. // url:"/pages/store/payH5"
  559. // })
  560. } else if (res.type == 'hf') {
  561. var payObj = JSON.parse(res.data.pay_info);
  562. jweixin.config({
  563. debug: false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来,若要查看传入的参数,可以在pc端打开,参数信息会通过log打出,仅在pc端时才会打印。
  564. appId: payObj.appId, // 必填,公众号的唯一标识
  565. timestamp: payObj.timeStamp, // 必填,生成签名的时间戳
  566. nonceStr: payObj.nonceStr, // 必填,生成签名的随机串
  567. signature: payObj.paySign, // 必填,签名
  568. jsApiList: ['chooseWXPay'] // 必填,需要使用的JS接口列表
  569. })
  570. jweixin.ready(function() {
  571. jweixin.chooseWXPay({
  572. timestamp: payObj.timeStamp, // 时间戳
  573. nonceStr: payObj.nonceStr, // 随机数
  574. package: payObj.package, //
  575. signType: payObj.signType,
  576. paySign: payObj.paySign, // 签名
  577. success: function() {
  578. uni.showToast({
  579. title: '支付成功'
  580. });
  581. setTimeout(() => {
  582. uni.navigateTo({
  583. url: `/pages/store/packageOrderPaySuccess?orderId=${that.orderId}`
  584. });
  585. }, 2000);
  586. },
  587. cancel: function() {
  588. uni.showToast({
  589. title: '取消支付',
  590. icon: 'none'
  591. });
  592. },
  593. fail: function(res) {
  594. uni.showToast({
  595. title: '支付失败' + JSON.stringify(res),
  596. icon: 'none'
  597. });
  598. }
  599. })
  600. })
  601. }
  602. } else {
  603. uni.showToast({
  604. icon: 'none',
  605. title: res.msg,
  606. });
  607. }
  608. },
  609. rej => {}
  610. );
  611. } else {
  612. uni.showToast({
  613. title: '请在微信内打开',
  614. icon: 'none'
  615. })
  616. }
  617. // #endif
  618. // #ifdef APP-PLUS
  619. plus.share.getServices(function(res) {
  620. var sweixin = null;
  621. for (var i = 0; i < res.length; i++) {
  622. var t = res[i];
  623. if (t.id == 'weixin') {
  624. sweixin = t;
  625. }
  626. }
  627. if (sweixin) {
  628. console.log('调起小程序')
  629. // that.$refs.popPayType.close()
  630. that.$refs.popTip.open()
  631. //唤起微信跳转小程序
  632. sweixin.launchMiniProgram({
  633. // id: "gh_0b4b9e32adba",
  634. id: getApp().globalData.miniprogamId,
  635. // path:'pages_order/packagePayment?orderId='+that.orderId+"&payMethod=app",
  636. path: 'pages/shopping/paymentOrder?orderId=' + that.orderId + "&payMethod=app",
  637. type: 0
  638. }, function() {
  639. console.log("微信唤起成功");
  640. return true;
  641. }, function(e) {
  642. console.log("微信唤起失败", e);
  643. uni.showToast({
  644. title: '微信唤起失败,请检查是否有微信应用',
  645. icon: 'none'
  646. })
  647. return false;
  648. })
  649. } else {
  650. uni.showToast({
  651. title: '微信唤起失败,请检查是否有微信应用',
  652. icon: 'none',
  653. duration: 3000
  654. });
  655. return false;
  656. }
  657. }, function(res) {
  658. console.log(JSON.stringify(res));
  659. });
  660. // #endif
  661. },
  662. async payOrder() {
  663. let params = {
  664. orderId: this.orderId,
  665. type: 'store'
  666. }
  667. let that = this
  668. if (this.order.payType == 1) {
  669. const res = await wxPayment(params)
  670. if (res.code == 200) {
  671. let payData = res.data
  672. uni.requestPayment({
  673. provider: 'wxpay',
  674. orderInfo: {
  675. appid: payData.appId,
  676. noncestr: payData.nonceStr,
  677. package: payData.packageValue,
  678. partnerid: payData.partnerId,
  679. prepayid: payData.prepayId,
  680. timestamp: payData.timeStamp,
  681. sign: payData.sign,
  682. },
  683. success: function(res) {
  684. that.$refs.popTip.open()
  685. uni.hideLoading();
  686. // uni.redirectTo({
  687. // url: `/pages_mall/paymentSuccess?order=${JSON.stringify(that.order)}`
  688. // })
  689. },
  690. fail: function(err) {
  691. that.$refs.popTip.open()
  692. uni.showToast({
  693. icon: 'none',
  694. title: "支付失败",
  695. });
  696. uni.hideLoading();
  697. },
  698. });
  699. }
  700. } else if (this.order.payType == 99) {
  701. const res = await aliPayment(params)
  702. if (res.code == 200) {
  703. let alipayScheme = ''
  704. if (uni.getSystemInfoSync().platform == 'android') {
  705. alipayScheme = `alipays://platformapi/startApp?&saId=10000007&qrcode=${res.data.qr_code}`;
  706. } else {
  707. alipayScheme = `alipay://platformapi/startApp?&saId=10000007&qrcode=${res.data.qr_code}`;
  708. }
  709. console.log(alipayScheme)
  710. plus.runtime.openURL(alipayScheme, function(error) {
  711. console.error('打开支付宝失败: ' + error);
  712. });
  713. that.$refs.popTip.open()
  714. }
  715. }
  716. }
  717. }
  718. }
  719. </script>
  720. <style lang="scss" scoped>
  721. .content {
  722. height: 100%;
  723. min-height: 100vh;
  724. height: 100%;
  725. display: flex;
  726. flex-direction: column;
  727. margin-top: 168rpx;
  728. box-sizing: border-box;
  729. // justify-content: space-between;
  730. .inner {
  731. padding: 20upx;
  732. .time-price {
  733. box-sizing: border-box;
  734. padding: 20upx 0upx;
  735. background: #FFFFFF;
  736. border-radius: 16upx;
  737. display: flex;
  738. flex-direction: column;
  739. align-items: center;
  740. .time {
  741. font-size: 32upx;
  742. font-family: PingFang SC;
  743. font-weight: 500;
  744. color: #222222;
  745. line-height: 1;
  746. text-align: center;
  747. }
  748. .desc {
  749. margin: 30upx 0upx 15upx;
  750. font-size: 26upx;
  751. font-family: PingFang SC;
  752. color: #999999;
  753. line-height: 1;
  754. text-align: center;
  755. }
  756. .price-box {
  757. display: flex;
  758. align-items: flex-end;
  759. margin-top: 28upx;
  760. .unit {
  761. font-size: 32upx;
  762. font-family: PingFang SC;
  763. font-weight: bold;
  764. color: #FF6633;
  765. line-height: 1.3;
  766. margin-right: 10upx;
  767. }
  768. .num {
  769. font-size: 56upx;
  770. font-family: PingFang SC;
  771. font-weight: bold;
  772. color: #FF6633;
  773. line-height: 1;
  774. }
  775. }
  776. }
  777. .pay-type {
  778. box-sizing: border-box;
  779. background: #FFFFFF;
  780. border-radius: 16upx;
  781. margin-top: 20upx;
  782. padding: 40upx 30upx;
  783. display: flex;
  784. flex-direction: column;
  785. justify-content: space-between;
  786. .title {
  787. font-size: 28upx;
  788. font-family: PingFang SC;
  789. font-weight: 500;
  790. color: #999999;
  791. line-height: 1;
  792. margin-bottom: 10upx;
  793. }
  794. .item {
  795. padding: 15upx 0upx;
  796. display: flex;
  797. align-items: center;
  798. justify-content: space-between;
  799. .left {
  800. display: flex;
  801. align-items: center;
  802. image {
  803. width: 44upx;
  804. height: 44upx;
  805. margin-right: 20upx;
  806. }
  807. .text {
  808. font-size: 30upx;
  809. font-family: PingFang SC;
  810. font-weight: bold;
  811. color: #222222;
  812. line-height: 1;
  813. }
  814. }
  815. }
  816. }
  817. .order-info {
  818. margin-top: 20upx;
  819. background: #FFFFFF;
  820. border-radius: 16upx;
  821. padding: 40upx 30upx;
  822. .title {
  823. font-size: 30upx;
  824. font-family: PingFang SC;
  825. font-weight: bold;
  826. color: #222222;
  827. line-height: 1;
  828. }
  829. .item {
  830. margin-top: 40upx;
  831. display: flex;
  832. align-items: center;
  833. justify-content: space-between;
  834. .label {
  835. font-size: 26upx;
  836. font-family: PingFang SC;
  837. font-weight: 500;
  838. color: #666666;
  839. line-height: 1;
  840. }
  841. .text {
  842. font-size: 26upx;
  843. font-family: PingFang SC;
  844. font-weight: 500;
  845. color: #222222;
  846. line-height: 32upx;
  847. }
  848. .cont-text {
  849. font-size: 26upx;
  850. font-family: PingFang SC;
  851. font-weight: 500;
  852. color: #666666;
  853. .bold {
  854. color: #111111;
  855. }
  856. }
  857. .sn-box {
  858. display: flex;
  859. align-items: center;
  860. .copy-btn {
  861. width: 58upx;
  862. height: 32upx;
  863. line-height: 32upx;
  864. text-align: center;
  865. font-size: 22upx;
  866. font-family: PingFang SC;
  867. font-weight: 500;
  868. color: #222222;
  869. background: #F5F5F5;
  870. border-radius: 4upx;
  871. margin-left: 24upx;
  872. }
  873. }
  874. }
  875. .line {
  876. width: 100%;
  877. height: 1px;
  878. background: #F0F0F0;
  879. margin-top: 30upx;
  880. }
  881. }
  882. }
  883. .btn-box {
  884. height: 242upx;
  885. background: #FFFFFF;
  886. display: flex;
  887. align-items: center;
  888. justify-content: center;
  889. flex-direction: column;
  890. .btn {
  891. width: 91.73%;
  892. height: 88upx;
  893. line-height: 88upx;
  894. font-size: 30upx;
  895. font-family: PingFang SC;
  896. font-weight: bold;
  897. color: #FFFFFF;
  898. text-align: center;
  899. background: #FF233C;
  900. border-radius: 44upx;
  901. margin-bottom: 10rpx;
  902. }
  903. .other-btn {
  904. width: 91.73%;
  905. height: 88upx;
  906. line-height: 88upx;
  907. font-size: 30upx;
  908. font-family: PingFang SC;
  909. font-weight: bold;
  910. color: #FF233C;
  911. border: 1rpx solid #FF233C;
  912. text-align: center;
  913. background: #FFFFFF;
  914. border-radius: 44upx;
  915. margin-bottom: 10rpx;
  916. position: relative;
  917. .share {
  918. display: inline-block;
  919. position: absolute;
  920. top: 0;
  921. left: 0;
  922. width: 100%;
  923. height: 100%;
  924. opacity: 0;
  925. }
  926. }
  927. }
  928. }
  929. .pay-box {
  930. border-radius: 30rpx 30rpx 0rpx 0rpx;
  931. padding: 30rpx;
  932. height: 350rpx;
  933. background-color: #fff;
  934. width: 100%;
  935. display: flex;
  936. flex-direction: column;
  937. text-align: center;
  938. justify-content: flex-start;
  939. .title {
  940. font-size: 32rpx;
  941. font-weight: bold;
  942. color: #111;
  943. }
  944. .pay-list {
  945. margin-top: 50rpx;
  946. display: flex;
  947. text-align: center;
  948. justify-content: center;
  949. .pay-item {
  950. margin: 10rpx;
  951. padding: 30rpx 0rpx;
  952. border-radius: 60rpx;
  953. background-color: green;
  954. flex: 1;
  955. display: flex;
  956. text-align: center;
  957. justify-content: center;
  958. image {
  959. width: 40rpx;
  960. height: 40rpx;
  961. }
  962. .name {
  963. margin-left: 15rpx;
  964. font-size: 32rpx;
  965. font-weight: bold;
  966. color: #fff;
  967. }
  968. }
  969. .wx {
  970. background-color: #09ba08;
  971. }
  972. .alipay {
  973. background-color: #04a9ed;
  974. }
  975. }
  976. }
  977. </style>