payment.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253
  1. <template>
  2. <u-popup :show="payshow" @close="payclose" @open="payopen" round="12" :closeable="true">
  3. <view :class="[AppTheme]" class="app">
  4. <view class="price-box">
  5. <text>支付金额</text>
  6. <text class="price text-neutral">{{params.money}}</text>
  7. </view>
  8. <view class="pay-type-list">
  9. <radio-group>
  10. <view v-if="weixinpay2" class="type-item b-b" @click="changepaytype(1)">
  11. <u-icon name="weixin-fill" color="#62b900" size="30"></u-icon>
  12. <view class="con">
  13. <text class="tit">微信支付</text>
  14. <text style="padding-top: 10rpx;">推荐使用微信支付</text>
  15. </view>
  16. <label class="radio">
  17. <radio value="1" :color="primary" :checked='params.paytype == 1' />
  18. </radio>
  19. </label>
  20. </view>
  21. <!-- #ifdef APP-PLUS || H5 -->
  22. <view v-if="alipay2" class="type-item" @click="changepaytype(3)">
  23. <u-icon name="zhifubao" color="rgb(85, 170, 255)" size="30"></u-icon>
  24. <view class="con">
  25. <text class="tit">支付宝支付</text>
  26. </view>
  27. <label class="radio">
  28. <radio value="3" :color="primary" :checked='params.paytype == 3' />
  29. </radio>
  30. </label>
  31. </view>
  32. <!-- #endif -->
  33. <view v-if="zhtpay" class="type-item" @click="changepaytype(2)">
  34. <u-icon name="red-packet-fill" color="rgb(224, 116, 114)" size="30"></u-icon>
  35. <view class="con">
  36. <text class="tit">余额支付</text>
  37. <text style="padding-top: 10rpx;">可用余额 ¥{{balance}}</text>
  38. </view>
  39. <label class="radio">
  40. <radio value="2" :color="primary" :checked='params.paytype == 2' />
  41. </radio>
  42. </label>
  43. </view>
  44. </radio-group>
  45. </view>
  46. <text class="mix-btn bg-linear-gradient" @click="confirm">确认支付</text>
  47. <u-keyboard ref="uKeyboard" mode="number" :tooltip="false" :safeAreaInsetBottom="true" :overlay="true"
  48. :closeOnClickOverlay="true" :dotDisabled="false" @change="onChange" @backspace="onBackspace"
  49. :show="show">
  50. <view>
  51. <view class="u-text-center u-padding-20 money">
  52. <view class="text-neutral">
  53. <text>{{params.money}}</text>
  54. <text class="u-font-20 u-padding-left-10">元</text>
  55. </view>
  56. <view class="u-padding-10 close" data-flag="false" @tap="showPop(false)">
  57. <u-icon name="close" color="#333333" size="28"></u-icon>
  58. </view>
  59. </view>
  60. <view class="u-flex u-row-center codeinput" style="margin: 20rpx 0; padding: auto;100%;">
  61. <u-code-input :color="primary" :borderColor="primary" :space="20" size="40" mode="box"
  62. :maxlength="6" :dot="true" v-model="password" :disabledKeyboard="true" @finish="finish">
  63. </u-code-input>
  64. </view>
  65. </view>
  66. </u-keyboard>
  67. </view>
  68. </u-popup>
  69. </template>
  70. <script>
  71. // #ifdef H5
  72. var wx = require('jweixin-module');
  73. // #endif
  74. import wallApi from '@/api/wall/index.js';
  75. import cart from '@/api/cart/index.js';
  76. import api from '@/api/mall/index.js';
  77. import adoptApi from '@/api/home/index.js';
  78. import {
  79. allKeys
  80. } from '../../js/underscore';
  81. export default {
  82. name: "payment",
  83. props: ["channel", "weixinpay", "alipay", "zhtpay"], //1:(商品,砍价 ,拼团),2:认养,,3:充值,4:租地,5:活动,6:保证金
  84. data() {
  85. return {
  86. primary: this.$theme.primary,
  87. settingFile: getApp().globalData.siteinfo,
  88. payshow: false,
  89. show: false,
  90. password: '',
  91. balance: 0,
  92. params: {
  93. // 支付方式
  94. paytype: 1, //1:微信,2:余额,3:支付宝
  95. systype: '', //h5 或 app 或 mpweixin
  96. money: 0
  97. },
  98. weixinpay2: false,
  99. alipay2: false,
  100. };
  101. },
  102. created() {
  103. let that = this;
  104. wallApi.income({}).then(res => {
  105. if (res.status == 200) {
  106. that.balance = res.data.money; //余额
  107. }
  108. });
  109. let config = that.$init_config(1, function(res) {
  110. if (res && res.app) {
  111. that.weixinpay2 = res.app.pay.wx.isopen;
  112. that.alipay2 = res.app.pay.ali.isopen;
  113. }
  114. });
  115. },
  116. methods: {
  117. init(data) {
  118. let that = this;
  119. if (data) {
  120. that.params = data;
  121. that.params.money = parseFloat(that.params.money).toFixed(2);
  122. // #ifdef APP-PLUS
  123. that.params.systype = 'app'
  124. // #endif
  125. // #ifdef H5
  126. that.params.systype = 'h5'
  127. // #endif
  128. // #ifdef MP-WEIXIN
  129. that.params.systype = 'mpweixin'
  130. // #endif
  131. }
  132. },
  133. payopen(data) {
  134. let that = this;
  135. that.init(data);
  136. that.payshow = true;
  137. },
  138. payclose() {
  139. let that = this;
  140. that.payshow = false;
  141. },
  142. changepaytype(type) {
  143. let that = this;
  144. that.params.paytype = type;
  145. },
  146. confirm() {
  147. let that = this;
  148. if (that.params.paytype == 1) {
  149. that.paywx();
  150. } else if (that.params.paytype == 2) {
  151. if (that.channel != 3) {
  152. that.show = true;
  153. that.password = ''
  154. } else {
  155. uni.showToast({
  156. title: '请选择正确的支付方式',
  157. icon: 'none'
  158. })
  159. return;
  160. }
  161. } else if (that.params.paytype == 3) {
  162. that.payali();
  163. } else {
  164. uni.showToast({
  165. title: '请选择正确的支付方式',
  166. icon: 'none'
  167. })
  168. return;
  169. }
  170. },
  171. onChange(val) {
  172. let that = this;
  173. if (that.password.length < 6) {
  174. that.password += val;
  175. }
  176. if (that.password.length >= 6) {
  177. if (that.params.paytype == 1) {
  178. that.paywx();
  179. } else if (that.params.paytype == 2) {
  180. that.paybalance();
  181. }
  182. }
  183. },
  184. onBackspace(e) {
  185. let that = this;
  186. if (that.password.length > 0) {
  187. that.password = that.password.substring(0, that.password.length - 1);
  188. }
  189. },
  190. paywx() {
  191. let that = this;
  192. if (that.channel == 1) {
  193. that.$paycenter.paygood(that.params).then(res => {
  194. if (res.status === 0 || res.code === 0) {
  195. uni.showToast({
  196. title: res.msg,
  197. icon: 'none'
  198. })
  199. } else {
  200. // #ifdef APP-PLUS
  201. that.wxPayAPPPLUS(res.data)
  202. // #endif
  203. // #ifdef H5
  204. that.wxPayH5(res.data)
  205. // #endif
  206. // #ifdef MP-WEIXIN
  207. that.wxPayWEIXIN(res.data)
  208. // #endif
  209. }
  210. })
  211. } else if (that.channel == 2) {
  212. that.$paycenter.payrenyang(that.params).then(res => {
  213. if (res.status === 0 || res.code === 0) {
  214. uni.showToast({
  215. title: res.msg,
  216. icon: 'none'
  217. })
  218. } else {
  219. // #ifdef APP-PLUS
  220. that.wxPayAPPPLUS(res.data)
  221. // #endif
  222. // #ifdef H5
  223. that.wxPayH5(res.data)
  224. // #endif
  225. // #ifdef MP-WEIXIN
  226. that.wxPayWEIXIN(res.data)
  227. // #endif
  228. }
  229. })
  230. } else if (that.channel == 3) {
  231. that.$paycenter.paycz(that.params).then(res => {
  232. if (res.status === 0 || res.code === 0) {
  233. uni.showToast({
  234. title: res.msg,
  235. icon: 'none'
  236. })
  237. } else {
  238. // #ifdef APP-PLUS
  239. that.wxPayAPPPLUS(res.data)
  240. // #endif
  241. // #ifdef H5
  242. that.wxPayH5(res.data)
  243. // #endif
  244. // #ifdef MP-WEIXIN
  245. that.wxPayWEIXIN(res.data)
  246. // #endif
  247. }
  248. })
  249. } else if (that.channel == 4) {
  250. that.$paycenter.payland(that.params).then(res => {
  251. if (res.status === 0 || res.code === 0) {
  252. uni.showToast({
  253. title: res.msg,
  254. icon: 'none'
  255. })
  256. } else {
  257. // #ifdef APP-PLUS
  258. that.wxPayAPPPLUS(res.data)
  259. // #endif
  260. // #ifdef H5
  261. that.wxPayH5(res.data)
  262. // #endif
  263. // #ifdef MP-WEIXIN
  264. that.wxPayWEIXIN(res.data)
  265. // #endif
  266. }
  267. })
  268. } else if (that.channel == 5) {
  269. that.$paycenter.payactivity(that.params).then(res => {
  270. if (res.status === 0 || res.code === 0) {
  271. uni.showToast({
  272. title: res.msg,
  273. icon: 'none'
  274. })
  275. } else {
  276. // #ifdef APP-PLUS
  277. that.wxPayAPPPLUS(res.data)
  278. // #endif
  279. // #ifdef H5
  280. that.wxPayH5(res.data)
  281. // #endif
  282. // #ifdef MP-WEIXIN
  283. that.wxPayWEIXIN(res.data)
  284. // #endif
  285. }
  286. })
  287. } else if (that.channel == 6) {
  288. that.$paycenter.renewal(that.params).then(res => {
  289. if (res.status === 0 || res.code === 0) {
  290. uni.showToast({
  291. title: res.msg,
  292. icon: 'none'
  293. })
  294. } else {
  295. // #ifdef APP-PLUS
  296. that.wxPayAPPPLUS(res.data)
  297. // #endif
  298. // #ifdef H5
  299. that.wxPayH5(res.data)
  300. // #endif
  301. // #ifdef MP-WEIXIN
  302. that.wxPayWEIXIN(res.data)
  303. // #endif
  304. }
  305. })
  306. } else if (that.channel == 7) {
  307. that.$paycenter.seedpay(that.params).then(res => {
  308. if (res.status === 0 || res.code === 0) {
  309. uni.showToast({
  310. title: res.msg,
  311. icon: 'none'
  312. })
  313. } else {
  314. // #ifdef APP-PLUS
  315. that.wxPayAPPPLUS(res.data)
  316. // #endif
  317. // #ifdef H5
  318. that.wxPayH5(res.data)
  319. // #endif
  320. // #ifdef MP-WEIXIN
  321. that.wxPayWEIXIN(res.data)
  322. // #endif
  323. }
  324. })
  325. } else if (that.channel == 8) {
  326. that.$paycenter.payserve(that.params).then(res => {
  327. if (res.status === 0 || res.code === 0) {
  328. uni.showToast({
  329. title: res.msg,
  330. icon: 'none'
  331. })
  332. } else {
  333. // #ifdef APP-PLUS
  334. that.wxPayAPPPLUS(res.data)
  335. // #endif
  336. // #ifdef H5
  337. that.wxPayH5(res.data)
  338. // #endif
  339. // #ifdef MP-WEIXIN
  340. that.wxPayWEIXIN(res.data)
  341. // #endif
  342. }
  343. })
  344. } else if (that.channel == 9) {
  345. that.$paycenter.operator(that.params).then(res => {
  346. if (res.status === 0 || res.code === 0) {
  347. uni.showToast({
  348. title: res.msg,
  349. icon: 'none'
  350. })
  351. } else {
  352. // #ifdef APP-PLUS
  353. that.wxPayAPPPLUS(res.data)
  354. // #endif
  355. // #ifdef H5
  356. that.wxPayH5(res.data)
  357. // #endif
  358. // #ifdef MP-WEIXIN
  359. that.wxPayWEIXIN(res.data)
  360. // #endif
  361. }
  362. })
  363. } else if (that.channel == 10) {
  364. that.$paycenter.paybond(that.params).then(res => {
  365. if (res.status === 0 || res.code === 0) {
  366. uni.showToast({
  367. title: res.msg,
  368. icon: 'none'
  369. })
  370. } else {
  371. // #ifdef APP-PLUS
  372. that.wxPayAPPPLUS(res.data)
  373. // #endif
  374. // #ifdef H5
  375. that.wxPayH5(res.data)
  376. // #endif
  377. // #ifdef MP-WEIXIN
  378. that.wxPayWEIXIN(res.data)
  379. // #endif
  380. }
  381. })
  382. }
  383. },
  384. payali() {
  385. let that = this;
  386. if (that.channel == 1) {
  387. that.$paycenter.paygood(that.params).then(res => {
  388. if (res.status === 0 || res.code === 0) {
  389. uni.showToast({
  390. title: res.msg,
  391. icon: 'none'
  392. })
  393. } else {
  394. // #ifdef APP-PLUS
  395. that.aliPayAPPPLUS(res.data)
  396. // #endif
  397. // #ifdef H5
  398. that.aliPayH5(res.data)
  399. // #endif
  400. }
  401. })
  402. } else if (that.channel == 2) {
  403. that.$paycenter.payrenyang(that.params).then(res => {
  404. if (res.status === 0 || res.code === 0) {
  405. uni.showToast({
  406. title: res.msg,
  407. icon: 'none'
  408. })
  409. } else {
  410. // #ifdef APP-PLUS
  411. that.aliPayAPPPLUS(res.data)
  412. // #endif
  413. // #ifdef H5
  414. that.aliPayH5(res.data)
  415. // #endif
  416. }
  417. })
  418. } else if (that.channel == 3) {
  419. that.$paycenter.paycz(that.params).then(res => {
  420. if (res.status === 0 || res.code === 0) {
  421. uni.showToast({
  422. title: res.msg,
  423. icon: 'none'
  424. })
  425. } else {
  426. // #ifdef APP-PLUS
  427. that.aliPayAPPPLUS(res.data)
  428. // #endif
  429. // #ifdef H5
  430. that.aliPayH5(res.data)
  431. // #endif
  432. }
  433. })
  434. } else if (that.channel == 4) {
  435. that.$paycenter.payland(that.params).then(res => {
  436. if (res.status === 0 || res.code === 0) {
  437. uni.showToast({
  438. title: res.msg,
  439. icon: 'none'
  440. })
  441. } else {
  442. // #ifdef APP-PLUS
  443. that.aliPayAPPPLUS(res.data)
  444. // #endif
  445. // #ifdef H5
  446. that.aliPayH5(res.data)
  447. // #endif
  448. }
  449. })
  450. } else if (that.channel == 5) {
  451. that.$paycenter.payactivity(that.params).then(res => {
  452. if (res.status === 0 || res.code === 0) {
  453. uni.showToast({
  454. title: res.msg,
  455. icon: 'none'
  456. })
  457. } else {
  458. // #ifdef APP-PLUS
  459. that.aliPayAPPPLUS(res.data)
  460. // #endif
  461. // #ifdef H5
  462. that.aliPayH5(res.data)
  463. // #endif
  464. }
  465. })
  466. } else if (that.channel == 6) {
  467. that.$paycenter.renewal(that.params).then(res => {
  468. if (res.status === 0 || res.code === 0) {
  469. uni.showToast({
  470. title: res.msg,
  471. icon: 'none'
  472. })
  473. } else {
  474. // #ifdef APP-PLUS
  475. that.aliPayAPPPLUS(res.data)
  476. // #endif
  477. // #ifdef H5
  478. that.aliPayH5(res.data)
  479. // #endif
  480. }
  481. })
  482. } else if (that.channel == 7) {
  483. that.$paycenter.seedpay(that.params).then(res => {
  484. if (res.status === 0 || res.code === 0) {
  485. uni.showToast({
  486. title: res.msg,
  487. icon: 'none'
  488. })
  489. } else {
  490. // #ifdef APP-PLUS
  491. that.aliPayAPPPLUS(res.data)
  492. // #endif
  493. // #ifdef H5
  494. that.aliPayH5(res.data)
  495. // #endif
  496. }
  497. })
  498. } else if (that.channel == 8) {
  499. that.$paycenter.payserve(that.params).then(res => {
  500. if (res.status === 0 || res.code === 0) {
  501. uni.showToast({
  502. title: res.msg,
  503. icon: 'none'
  504. })
  505. } else {
  506. // #ifdef APP-PLUS
  507. that.aliPayAPPPLUS(res.data)
  508. // #endif
  509. // #ifdef H5
  510. that.aliPayH5(res.data)
  511. // #endif
  512. }
  513. })
  514. } else if (that.channel == 9) {
  515. that.$paycenter.operator(that.params).then(res => {
  516. if (res.status === 0 || res.code === 0) {
  517. uni.showToast({
  518. title: res.msg,
  519. icon: 'none'
  520. })
  521. } else {
  522. // #ifdef APP-PLUS
  523. that.aliPayAPPPLUS(res.data)
  524. // #endif
  525. // #ifdef H5
  526. that.aliPayH5(res.data)
  527. // #endif
  528. }
  529. })
  530. } else if (that.channel == 10) {
  531. that.$paycenter.paybond(that.params).then(res => {
  532. if (res.status === 0 || res.code === 0) {
  533. uni.showToast({
  534. title: res.msg,
  535. icon: 'none'
  536. })
  537. } else {
  538. // #ifdef APP-PLUS
  539. that.aliPayAPPPLUS(res.data)
  540. // #endif
  541. // #ifdef H5
  542. that.aliPayH5(res.data)
  543. // #endif
  544. }
  545. })
  546. }
  547. },
  548. paybalance() {
  549. let that = this;
  550. if (that.channel == 1) {
  551. that.paybalance1()
  552. } else if (that.channel == 2) {
  553. that.paybalance2()
  554. } else if (that.channel == 4) {
  555. that.paybalance4()
  556. } else if (that.channel == 5) {
  557. that.paybalance5()
  558. } else if (that.channel == 6) {
  559. that.paybalance6()
  560. } else if (that.channel == 7) {
  561. that.paybalance7()
  562. } else if (that.channel == 8) {
  563. that.paybalance8()
  564. } else if (that.channel == 9) {
  565. that.paybalance9()
  566. } else if (that.channel == 10) {
  567. that.paybalance10()
  568. }
  569. },
  570. wxPayWEIXIN(paydata) {
  571. let that = this;
  572. uni.requestPayment({
  573. provider: 'wxpay',
  574. timeStamp: paydata.timeStamp,
  575. nonceStr: paydata.nonceStr,
  576. package: paydata.package,
  577. signType: paydata.signType,
  578. paySign: paydata.paySign,
  579. success: function(res) {
  580. uni.showToast({
  581. title: '支付成功',
  582. icon: 'success',
  583. duration: 1500
  584. });
  585. that.payfinish()
  586. },
  587. fail: function(err) {
  588. console.log('err', err)
  589. }
  590. });
  591. },
  592. wxPayH5(paydata) {
  593. let that = this;
  594. wx.config({
  595. debug: false,
  596. appId: paydata.appid, // 必填,公众号的唯一标识
  597. timestamp: paydata.timeStamp, // 必填,生成签名的时间戳
  598. nonceStr: paydata.nonceStr, // 必填,生成签名的随机串
  599. signature: paydata.paySign,
  600. jsApiList: ['chooseWXPay']
  601. });
  602. wx.ready(function() {
  603. wx.chooseWXPay({
  604. timestamp: paydata.timeStamp,
  605. nonceStr: paydata.nonceStr, // 支付签名随机串,不长于 32 位
  606. package: paydata.package,
  607. signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  608. paySign: paydata.paySign, // 支付签名
  609. success(res) {
  610. that.payfinish()
  611. },
  612. fail(err) {
  613. console.log('fail', err)
  614. uni.showToast({
  615. icon: 'none',
  616. title: '未完成支付!'
  617. })
  618. }
  619. });
  620. });
  621. },
  622. wxPayAPPPLUS(paydata) {
  623. let that = this;
  624. console.log('paydata',paydata)
  625. uni.requestPayment({
  626. provider: 'wxpay',
  627. orderInfo: paydata,
  628. success: function(res) {
  629. uni.showToast({
  630. title: '支付成功',
  631. icon: 'success',
  632. duration: 1500
  633. });
  634. that.payfinish()
  635. },
  636. fail: function(err) {
  637. console.log('fail', err)
  638. uni.showToast({
  639. title: err.errMsg,
  640. icon: 'none'
  641. })
  642. }
  643. });
  644. },
  645. aliPayH5(paydata) {
  646. let that = this;
  647. uni.showToast({
  648. icon: 'none',
  649. title: '暂未开放!'
  650. })
  651. wx.config({
  652. debug: false,
  653. appId: paydata.appid, // 必填,公众号的唯一标识
  654. timestamp: paydata.timeStamp, // 必填,生成签名的时间戳
  655. nonceStr: paydata.nonceStr, // 必填,生成签名的随机串
  656. signature: paydata.paySign,
  657. jsApiList: ['chooseWXPay']
  658. });
  659. wx.ready(function() {
  660. wx.chooseWXPay({
  661. timestamp: paydata.timeStamp,
  662. nonceStr: paydata.nonceStr, // 支付签名随机串,不长于 32 位
  663. package: paydata.package,
  664. signType: 'MD5', // 签名方式,默认为'SHA1',使用新版支付需传入'MD5'
  665. paySign: paydata.paySign, // 支付签名
  666. success(res) {
  667. that.payfinish()
  668. },
  669. fail(err) {
  670. console.log('fail', err)
  671. uni.showToast({
  672. icon: 'none',
  673. title: '未完成支付!'
  674. })
  675. }
  676. });
  677. });
  678. },
  679. aliPayAPPPLUS(paydata) {
  680. let that = this;
  681. console.log('paydata', paydata)
  682. uni.requestPayment({
  683. provider: 'alipay',
  684. orderInfo: paydata,
  685. success: function(res) {
  686. uni.showToast({
  687. title: '支付成功',
  688. icon: 'success',
  689. duration: 1500
  690. });
  691. that.payfinish()
  692. },
  693. fail: function(err) {
  694. console.log('fail', err)
  695. uni.showToast({
  696. title: err.errMsg,
  697. icon: 'none'
  698. })
  699. }
  700. });
  701. },
  702. //余额支付
  703. paybalance1() {
  704. let that = this;
  705. cart.checkPayPassword({
  706. password: that.password
  707. }).then(res => {
  708. uni.hideLoading();
  709. if (res.status == 200) {
  710. var pdata = {
  711. orderid: that.params.orderid,
  712. djqid: that.params.djqid,
  713. type: that.params.paytype == 1 ? 'wxpay' : 'money',
  714. paypass: that.password
  715. };
  716. api.pay(pdata)
  717. .then(res => {
  718. uni.showToast({
  719. title: res.msg,
  720. icon: "none"
  721. });
  722. if (res.status == 200) {
  723. that.payfinish()
  724. }
  725. });
  726. } else {
  727. uni.showToast({
  728. title: res.msg,
  729. icon: "none"
  730. });
  731. if (res.msg === '未设置支付密码,现在进行设置!') {
  732. setTimeout(() => {
  733. uni.navigateTo({
  734. url: '/pagesD/pages/set/changemima/changemima'
  735. })
  736. }, 1000)
  737. }
  738. }
  739. })
  740. },
  741. //余额支付
  742. paybalance2() {
  743. let that = this;
  744. cart.checkPayPassword({
  745. password: that.password
  746. }).then(res => {
  747. uni.hideLoading();
  748. if (res.status == 200) {
  749. var pdata = {
  750. orderid: that.params.orderid,
  751. djqid: that.params.djqid,
  752. type: that.params.paytype == 1 ? 'wxpay' : 'money',
  753. paypass: that.password
  754. };
  755. adoptApi.payNew(pdata)
  756. .then(res => {
  757. uni.showToast({
  758. title: res.msg,
  759. icon: "none"
  760. });
  761. if (res.status == 200) {
  762. that.payfinish()
  763. }
  764. });
  765. } else {
  766. uni.showToast({
  767. title: res.msg,
  768. icon: "none"
  769. });
  770. if (res.msg === '未设置支付密码,现在进行设置!') {
  771. setTimeout(() => {
  772. uni.navigateTo({
  773. url: '/pagesD/pages/set/changemima/changemima'
  774. })
  775. }, 1000)
  776. }
  777. }
  778. })
  779. },
  780. //余额支付
  781. paybalance4() {
  782. let that = this;
  783. cart.checkPayPassword({
  784. password: that.password
  785. }).then(res => {
  786. uni.hideLoading();
  787. if (res.status == 200) {
  788. let pdata = {
  789. order_info: JSON.stringify(that.params)
  790. };
  791. that.$paycenter.pay_soil_money(pdata)
  792. .then(res => {
  793. uni.showToast({
  794. title: res.msg,
  795. icon: "none"
  796. });
  797. if (res.status == 200) {
  798. that.payfinish()
  799. }
  800. });
  801. } else {
  802. uni.showToast({
  803. title: res.msg,
  804. icon: "none"
  805. });
  806. if (res.msg === '未设置支付密码,现在进行设置!') {
  807. setTimeout(() => {
  808. uni.navigateTo({
  809. url: '/pagesD/pages/set/changemima/changemima'
  810. })
  811. }, 1000)
  812. }
  813. }
  814. })
  815. },
  816. //余额支付
  817. paybalance5() {
  818. let that = this;
  819. cart.checkPayPassword({
  820. password: that.password
  821. }).then(res => {
  822. uni.hideLoading();
  823. if (res.status == 200) {
  824. that.$paycenter.pay_ac_money(that.params)
  825. .then(res => {
  826. uni.showToast({
  827. title: res.msg,
  828. icon: "none"
  829. });
  830. if (res.status == 200) {
  831. that.payfinish()
  832. }
  833. });
  834. } else {
  835. uni.showToast({
  836. title: res.msg,
  837. icon: "none"
  838. });
  839. if (res.msg === '未设置支付密码,现在进行设置!') {
  840. setTimeout(() => {
  841. uni.navigateTo({
  842. url: '/pagesD/pages/set/changemima/changemima'
  843. })
  844. }, 1000)
  845. }
  846. }
  847. })
  848. },
  849. //余额支付
  850. paybalance6() {
  851. let that = this;
  852. cart.checkPayPassword({
  853. password: that.password
  854. }).then(res => {
  855. uni.hideLoading();
  856. if (res.status == 200) {
  857. that.$paycenter.pay_renewal_money(that.params)
  858. .then(res => {
  859. uni.showToast({
  860. title: res.msg,
  861. icon: "none"
  862. });
  863. if (res.status == 200) {
  864. uni.showToast({
  865. title: res.msg,
  866. icon: "none"
  867. });
  868. setTimeout(() => {
  869. uni.navigateTo({
  870. url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
  871. that.params.orderid
  872. })
  873. }, 2000)
  874. }
  875. });
  876. } else {
  877. uni.showToast({
  878. title: res.msg,
  879. icon: "none"
  880. });
  881. if (res.msg === '未设置支付密码,现在进行设置!') {
  882. setTimeout(() => {
  883. uni.navigateTo({
  884. url: '/pagesD/pages/set/changemima/changemima'
  885. })
  886. }, 1000)
  887. }
  888. }
  889. })
  890. },
  891. //余额支付
  892. paybalance7() {
  893. let that = this;
  894. cart.checkPayPassword({
  895. password: that.password
  896. }).then(res => {
  897. uni.hideLoading();
  898. if (res.status == 200) {
  899. that.$paycenter.pay_seed_money(that.params)
  900. .then(res => {
  901. uni.showToast({
  902. title: res.msg,
  903. icon: "none"
  904. });
  905. if (res.status == 200) {
  906. uni.showToast({
  907. title: res.msg,
  908. icon: "none"
  909. });
  910. setTimeout(() => {
  911. uni.navigateTo({
  912. url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
  913. that.params.orderid
  914. })
  915. }, 2000)
  916. }
  917. });
  918. } else {
  919. uni.showToast({
  920. title: res.msg,
  921. icon: "none"
  922. });
  923. if (res.msg === '未设置支付密码,现在进行设置!') {
  924. setTimeout(() => {
  925. uni.navigateTo({
  926. url: '/pagesD/pages/set/changemima/changemima'
  927. })
  928. }, 1000)
  929. }
  930. }
  931. })
  932. },
  933. //余额支付
  934. paybalance8() {
  935. let that = this;
  936. cart.checkPayPassword({
  937. password: that.password
  938. }).then(res => {
  939. uni.hideLoading();
  940. if (res.status == 200) {
  941. that.$paycenter.pay_serve_money(that.params)
  942. .then(res => {
  943. uni.showToast({
  944. title: res.msg,
  945. icon: "none"
  946. });
  947. if (res.status == 200) {
  948. uni.showToast({
  949. title: res.msg,
  950. icon: "none"
  951. });
  952. setTimeout(() => {
  953. uni.navigateTo({
  954. url: '/pagesE/pages/plotdetails/plotdetails?orderid=' +
  955. that.params.orderid
  956. })
  957. }, 2000)
  958. }
  959. });
  960. } else {
  961. uni.showToast({
  962. title: res.msg,
  963. icon: "none"
  964. });
  965. if (res.msg === '未设置支付密码,现在进行设置!') {
  966. setTimeout(() => {
  967. uni.navigateTo({
  968. url: '/pagesD/pages/set/changemima/changemima'
  969. })
  970. }, 1000)
  971. }
  972. }
  973. })
  974. },
  975. //余额支付
  976. paybalance9() {
  977. let that = this;
  978. cart.checkPayPassword({
  979. password: that.password
  980. }).then(res => {
  981. uni.hideLoading();
  982. if (res.status == 200) {
  983. that.$paycenter.pay_operator_money(that.params)
  984. .then(res => {
  985. uni.showToast({
  986. title: res.msg,
  987. icon: "none"
  988. });
  989. if (res.status == 200) {
  990. uni.showToast({
  991. title: res.msg,
  992. icon: "none"
  993. });
  994. console.log(that.params.type, 'that.params.type')
  995. if (that.params.type == 2) {
  996. setTimeout(() => {
  997. uni.navigateTo({
  998. url: '/pagesE/pages/seedlist/decoration/decoration?id=' +
  999. that.params.order_id
  1000. })
  1001. }, 2000)
  1002. } else {
  1003. setTimeout(() => {
  1004. uni.navigateTo({
  1005. url: '/pagesE/pages/seedlist/crop?id=' + that
  1006. .params.seed_id
  1007. })
  1008. }, 2000)
  1009. }
  1010. }
  1011. });
  1012. } else {
  1013. uni.showToast({
  1014. title: res.msg,
  1015. icon: "none"
  1016. });
  1017. if (res.msg === '未设置支付密码,现在进行设置!') {
  1018. setTimeout(() => {
  1019. uni.navigateTo({
  1020. url: '/pagesD/pages/set/changemima/changemima'
  1021. })
  1022. }, 1000)
  1023. }
  1024. }
  1025. })
  1026. },
  1027. //余额支付
  1028. paybalance10() {
  1029. let that = this;
  1030. cart.checkPayPassword({
  1031. password: that.password
  1032. }).then(res => {
  1033. uni.hideLoading();
  1034. if (res.status == 200) {
  1035. that.$paycenter.pay_bond_money(that.params)
  1036. .then(res => {
  1037. uni.showToast({
  1038. title: res.msg,
  1039. icon: "none"
  1040. });
  1041. if (res.status == 200) {
  1042. uni.showToast({
  1043. title: res.msg,
  1044. icon: "none"
  1045. });
  1046. setTimeout(() => {
  1047. uni.navigateTo({
  1048. url: '/pagesC/pages/merchantdetails/bond'
  1049. })
  1050. }, 1000)
  1051. }
  1052. });
  1053. } else {
  1054. uni.showToast({
  1055. title: res.msg,
  1056. icon: "none"
  1057. });
  1058. if (res.msg === '未设置支付密码,现在进行设置!') {
  1059. setTimeout(() => {
  1060. uni.navigateTo({
  1061. url: '/pagesD/pages/set/changemima/changemima'
  1062. })
  1063. }, 1000)
  1064. }
  1065. }
  1066. })
  1067. },
  1068. showPop(flag = true) {
  1069. let that = this;
  1070. that.password = '';
  1071. that.show = flag;
  1072. },
  1073. finish() {
  1074. },
  1075. payfinish() {
  1076. let that = this;
  1077. if (that.channel == 3) {
  1078. that.payclose();
  1079. //1:(商品,砍价 ,拼团),2:认养,,3:充值,4:租地,5:活动
  1080. uni.navigateBack(-1);
  1081. } else if (that.channel == 10) {
  1082. that.payclose();
  1083. uni.navigateTo({
  1084. url: '/pagesC/pages/merchantdetails/bond'
  1085. });
  1086. } else {
  1087. setTimeout(function() {
  1088. //1:(商品,砍价 ,拼团),2:认养,,3:充值,4:租地,5:活动
  1089. uni.navigateTo({
  1090. url: '/pagesE/pages/common/paySuccess?channel=' + that.channel
  1091. });
  1092. }, 1000)
  1093. }
  1094. }
  1095. }
  1096. }
  1097. </script>
  1098. <style lang='scss'>
  1099. .codeinput {
  1100. justify-content: space-evenly;
  1101. display: flex;
  1102. }
  1103. .app {
  1104. width: 100%;
  1105. }
  1106. .money {
  1107. font-size: 80rpx;
  1108. position: relative;
  1109. text-align: center;
  1110. .close {
  1111. position: absolute;
  1112. top: 20rpx;
  1113. right: 20rpx;
  1114. line-height: 28rpx;
  1115. font-size: 28rpx;
  1116. }
  1117. }
  1118. .tips {
  1119. color: $u-tips-color;
  1120. text-align: center;
  1121. }
  1122. .price-box {
  1123. background-color: #fff;
  1124. height: 160rpx;
  1125. display: flex;
  1126. flex-direction: column;
  1127. justify-content: center;
  1128. align-items: center;
  1129. font-size: 28upx;
  1130. color: #909399;
  1131. .price {
  1132. font-size: 50upx;
  1133. margin-top: 12upx;
  1134. &:before {
  1135. content: '¥';
  1136. font-size: 40upx;
  1137. }
  1138. }
  1139. }
  1140. .pay-type-list {
  1141. /* margin-top: 20upx; */
  1142. background-color: #fff;
  1143. padding-left: 60upx;
  1144. .type-item {
  1145. height: 120upx;
  1146. display: flex;
  1147. justify-content: space-between;
  1148. align-items: center;
  1149. padding-right: 60upx;
  1150. font-size: 30upx;
  1151. position: relative;
  1152. .con {
  1153. margin-left: 20rpx;
  1154. }
  1155. }
  1156. .icon {
  1157. width: 100upx;
  1158. font-size: 52upx;
  1159. }
  1160. .icon-erjiye-yucunkuan {
  1161. color: #fe8e2e;
  1162. }
  1163. .icon-weixinzhifu {
  1164. color: #36cb59;
  1165. }
  1166. .icon-alipay {
  1167. color: #01aaef;
  1168. }
  1169. .tit {
  1170. font-size: $font-lg;
  1171. color: $font-color-dark;
  1172. margin-bottom: 4upx;
  1173. }
  1174. .con {
  1175. flex: 1;
  1176. display: flex;
  1177. flex-direction: column;
  1178. font-size: $font-sm;
  1179. color: $font-color-light;
  1180. }
  1181. }
  1182. .mix-btn {
  1183. display: flex;
  1184. align-items: center;
  1185. justify-content: center;
  1186. width: 630upx;
  1187. height: 80upx;
  1188. margin: 80upx auto 30upx;
  1189. font-size: $font-lg;
  1190. color: #fff;
  1191. border-radius: 10upx;
  1192. }
  1193. </style>