pay.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914
  1. <template>
  2. <view class="container">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="u-text-center u-plr30">
  5. <view class="mt82">
  6. <view class="u-ED3D07 u-font44 u-bold">
  7. <text class="u-ml10">{{ total_amount }}</text>
  8. </view>
  9. <view class="u-999 u-font22">付款金额</view>
  10. </view>
  11. <view class="u-bg-fff pay-select">
  12. <radio-group>
  13. <label class="u-flex-center-sb" @click="payWay(0)">
  14. <view class="u-flex-center">
  15. <text class="iconfont3 pay">&#x100dc;</text>
  16. <!-- <image class="img60" :src="imgUrl + '/weChat2.png'"></image> -->
  17. <view class="u-ml20 u-font28 u-181818">
  18. 余额支付<text class="u-font24 u-999">(可用余额 ¥ {{ balance || 0 }})</text>
  19. </view>
  20. </view>
  21. <view>
  22. <radio value="0" checked />
  23. </view>
  24. </label>
  25. <label class="u-flex-center-sb u-mt30" @click="payWay(1)">
  26. <view class="u-flex-center">
  27. <image class="img60" :src="imgUrl + '/weChat2.png'"></image>
  28. <view class="u-ml20 u-font28 u-181818">微信支付</view>
  29. </view>
  30. <view>
  31. <radio value="1" />
  32. </view>
  33. </label>
  34. <label class="u-flex-center-sb u-mt30" @click="payWay(2)">
  35. <view class="u-flex-center">
  36. <image class="img60" :src="imgUrl+'/alipay.png'"></image>
  37. <view class="u-ml20 u-font28 u-181818">支付宝支付</view>
  38. </view>
  39. <view>
  40. <radio value="2" />
  41. </view>
  42. </label>
  43. <!-- <label class="u-flex-center-sb u-mt30" @click="payWay(10)">
  44. <view class="u-flex-center">
  45. <image class="img60" :src="imgUrl+'/alipay.png'"></image>
  46. <view class="u-ml20 u-font28 u-181818">支付宝(Adapay)</view>
  47. </view>
  48. <view>
  49. <radio value="2" />
  50. </view>
  51. </label> -->
  52. <!-- <label class="u-flex-center-sb u-mt30" @click="payWay(14)">
  53. <view class="u-flex-center">
  54. <view class="iconfont3 bank-icon">&#xe607;</view>
  55. <view class="u-ml20 u-font28 u-181818">银行卡支付</view>
  56. </view>
  57. <view>
  58. <radio value="14" />
  59. </view>
  60. </label>
  61. <label class="u-flex-center-sb u-mt30" @click="payWay(12)">
  62. <view class="u-flex-center">
  63. <image class="img60" :src="imgUrl+'/alipay.png'"></image>
  64. <view class="u-ml20 u-font28 u-181818">支付宝(慧收钱)</view>
  65. </view>
  66. <view>
  67. <radio value="12" />
  68. </view>
  69. </label> -->
  70. <!-- <label class="u-flex-center-sb u-mt30" @click="payWay(3)">
  71. <view class="u-flex-center">
  72. <image class="img60" :src="imgUrl + '/money.png'"></image>
  73. <view class="u-ml20 u-font28 u-181818">
  74. 余额支付
  75. <text class="u-font24 u-999">(可用余额 ¥ {{ balance }})</text>
  76. </view>
  77. </view>
  78. <view><radio value="3" /></view>
  79. </label> -->
  80. <template v-if="banksList.length && false">
  81. <label class="u-mt30 bank" @click="payBankWay(14, item.id)" v-for="(item, index) in banksList"
  82. :key="item.id">
  83. <view class="box">
  84. <view class="left">
  85. <image :src="item.logo" mode="widthFix"></image>
  86. <text class="bank_name">{{item.local_bank_name || item.bank_name}}</text>
  87. <text>{{item.local_bank_card_type_name}}</text>
  88. </view>
  89. <view class="name">({{$mUtil.bankAccount(item.card_id)}})</view>
  90. </view>
  91. <view>
  92. <radio :value="String(item.id)" />
  93. </view>
  94. </label>
  95. </template>
  96. </radio-group>
  97. <!-- <label class="u-flex-center-sb u-mt50 banks" @click="banksHandler()">
  98. <view class="u-flex-center">
  99. <u-icon name="plus" color="#9A9A9A"></u-icon>管理银行卡
  100. </view>
  101. </label> -->
  102. </view>
  103. <view class="pay-btn">
  104. <button class=" u-flex-center u-btn-two" @click="$u.throttle(submitPay, 500)">
  105. <view class=" u-flex-center">
  106. <view>去付款</view>
  107. <uni-countdown :backgroundColor="'none'" :color="'#ffffff'" :splitorColor="'#ffffff'"
  108. :show-day="time1[0] > 0" :day="time1[0]" :hour="time1[1]" :minute="time1[2]" :second="time1[3]">
  109. </uni-countdown>
  110. </view>
  111. </button>
  112. <!-- <button class=" u-flex-center u-btn-two" v-if="payStatus == 14" @click="showBanksModel = true">
  113. <view class=" u-flex-center">
  114. <view>选择快捷银行卡支付</view>
  115. <uni-countdown :backgroundColor="'none'" :color="'#ffffff'" :splitorColor="'#ffffff'"
  116. :show-day="time1[0] > 0" :day="time1[0]" :hour="time1[1]" :minute="time1[2]" :second="time1[3]">
  117. </uni-countdown>
  118. </view>
  119. </button> -->
  120. <view class="u-flex-center u-mt20 u-999 u-font22">
  121. <view>
  122. 请在
  123. <!-- </view> {{$mUtil.patTime(expired_pay_time)}}<view> -->
  124. <!-- </view> {{payMinutes}}<view> -->
  125. </view>
  126. {{ payMinutes }}
  127. <view>分钟内完成付款,否则订单失效。</view>
  128. </view>
  129. </view>
  130. </view>
  131. <!--页面加载动画-->
  132. <ldLoading isFullScreen :active="loading"></ldLoading>
  133. <!-- 银行卡弹窗 -->
  134. <u-popup v-model="showBanksModel" mode="bottom" height="65%" border-radius="20" closeable safe-area-inset-bottom
  135. :mask-close-able="false" z-index="500">
  136. <view class="banks-content">
  137. <view class="add" @click="banksHandler()">+ 管理银行卡</view>
  138. <view class="header">银行卡支付</view>
  139. <template>
  140. <view class="banks" v-if="banksList.length > 0">
  141. <scroll-view class="scroll-box" scroll-y="true">
  142. <radio-group>
  143. <label class="item" :class="{'gray': !item.valid}" v-for="(item, index) in banksList" :key="item.id"
  144. @click="payBankWay(14, item.id)">
  145. <view class="box">
  146. <image :src="item.logo" mode="widthFix"></image>
  147. <text class="bank_name">{{item.local_bank_name || item.bank_name}}</text>
  148. <text>{{item.local_bank_card_type_name}}</text>
  149. </view>
  150. <view class="box">
  151. <view class="name">({{$mUtil.bankAccount(item.card_id)}})</view>
  152. <radio :value="String(item.id)" :checked="card_id == item.id" />
  153. </view>
  154. </label>
  155. </radio-group>
  156. </scroll-view>
  157. </view>
  158. <noData v-if="banksList.length <= 0"></noData>
  159. </template>
  160. <view class="banks-pay" @click="$u.throttle(submitPay, 500)" v-if="banksList.length">
  161. <text class="txt">确认支付</text>
  162. <uni-countdown :backgroundColor="'none'" :color="'#ffffff'" :splitorColor="'#ffffff'" :show-day="time1[0] > 0"
  163. :day="time1[0]" :hour="time1[1]" :minute="time1[2]" :second="time1[3]">
  164. </uni-countdown>
  165. </view>
  166. <view class="banks-pay" @click="banksHandler()" v-else>
  167. <text class="txt">请先添加银行卡</text>
  168. </view>
  169. </view>
  170. </u-popup>
  171. <u-modal v-model="showPayModel" ref="payModel" title="确认支付" :show-cancel-button="true" @confirm="payConfirm"
  172. @cancel="payCancel" :async-close="true" z-index="900">
  173. <view class="slot-content">
  174. <view class="paybody">
  175. <view class="header-text">
  176. <text>请输入银行预留手机号发送的短信验证,切记他人索取拒绝提供。</text>
  177. </view>
  178. <view class="sms">
  179. <u-input v-model="sms_code" type="number" maxlength="6" :clearable="false" placeholder="请输入预留手机号验证码" />
  180. <view class="retry-gary" :class="{'retry': codeCount > 0}" @click="retrySms()"><text
  181. v-if="codeCount > 0">{{codeCount}}S后</text>重发</view>
  182. </view>
  183. <!-- <u-message-input mode="bottomLine" :maxlength="6"></u-message-input> -->
  184. </view>
  185. </view>
  186. </u-modal>
  187. </view>
  188. </template>
  189. <script>
  190. let timer
  191. // let iPay = 0
  192. let payTimer
  193. import noData from "@/components/noData/nodata.vue"
  194. export default {
  195. components: {
  196. noData
  197. },
  198. data() {
  199. return {
  200. config: {
  201. back: true, //false是tolbar页面 是则不写
  202. title: '支付',
  203. color: '#1a1a1a',
  204. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  205. backgroundColor: [1, '#fff'],
  206. statusBarFontColor: '#FFFFFF'
  207. },
  208. total_amount: null,
  209. orderId: null,
  210. loading: false,
  211. expired_pay_time: null,
  212. payStatus: 0,
  213. balance: null,
  214. isGroup: false,
  215. isService: false,
  216. order_type: 1,
  217. time1: [0, 0, 0, 0],
  218. imgUrl: this.$mConfig.staticUrl,
  219. payMinutes: 0, // 支付剩余分钟数
  220. payOrder: {}, // 支付单详情
  221. banksList: [], // 有效银行卡
  222. card_id: '', // 银行卡id
  223. showPayModel: false, // 银行卡弹窗
  224. sms_code: '', // 银行卡支付短信验证码
  225. codeCount: 10, // 银行卡支付短信验证码重发倒计时
  226. payment_id: '', // 预支付id,
  227. showBanksModel: false,
  228. payS: 2000,
  229. iPay: 0
  230. };
  231. },
  232. onLoad(options) {
  233. if (options.id) {
  234. this.orderId = options.id;
  235. }
  236. if (options.total_amount) {
  237. this.total_amount = options.total_amount;
  238. }
  239. if (options.expired_pay_time) {
  240. this.expired_pay_time = options.expired_pay_time;
  241. this.time1 = this.$mUtil
  242. .countDown(this.expired_pay_time / 1000)
  243. .split(':')
  244. .map(val => Number(val));
  245. console.log('支付时间:' + options.expired_pay_time);
  246. let beginTime = new Date();
  247. let time = options.expired_pay_time - beginTime;
  248. let leave1 = time % (24 * 3600 * 1000); //计算天数后剩余的毫秒数
  249. //计算相差分钟数
  250. let leave2 = leave1 % (3600 * 1000); //计算小时数后剩余的毫秒数
  251. let minutes = Math.ceil(leave2 / (60 * 1000));
  252. // this.payMinutes = minutes
  253. console.log('分钟值:' + minutes);
  254. }
  255. if (options.type && options.type == 'group') {
  256. this.isGroup = true;
  257. }
  258. if (options.type && options.type == 'service') {
  259. this.isService = true;
  260. }
  261. this.accountInfo();
  262. this.returnList();
  263. console.log('分钟' + this.time1[2]);
  264. if (this.time1[3] == '0') {
  265. this.payMinutes = this.time1[2];
  266. } else {
  267. this.payMinutes = this.time1[2] + 1;
  268. }
  269. console.log('秒值:' + this.time1[3]);
  270. },
  271. onShow() {
  272. this.getBanks()
  273. },
  274. onBackPress() {
  275. if (this.order_type == 1) {
  276. uni.redirectTo({
  277. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  278. });
  279. } else {
  280. uni.redirectTo({
  281. url: '/pages/orderList/serviceOrder'
  282. });
  283. }
  284. return true;
  285. },
  286. onUnload() {
  287. clearInterval(timer)
  288. clearInterval(payTimer)
  289. },
  290. methods: {
  291. returnList() {
  292. this.$http.get(`/pay/order/sale-detail/${this.orderId}`).then(res => {
  293. if (res && res.code == 200) {
  294. this.order_type = res.page.pay_order.order_type;
  295. this.payOrder = res.page.pay_order;
  296. }
  297. });
  298. },
  299. accountInfo() {
  300. this.$http.get('/account/getAccountInfo').then(res => {
  301. if (res && res.code == 200) {
  302. this.balance = res.data.balance;
  303. }
  304. });
  305. },
  306. payWay(e) {
  307. console.log(e, 111)
  308. this.payStatus = e;
  309. },
  310. payBankWay(e, id) {
  311. this.payStatus = e;
  312. this.card_id = id
  313. },
  314. submitPay() {
  315. //微信支付
  316. if (this.payStatus == 1 || this.payStatus == 2 || this.payStatus == 10 || this.payStatus == 12 || this
  317. .payStatus == 14) {
  318. let data = {
  319. pay_order_id: this.orderId * 1,
  320. pay_mode: this.payStatus //1微信 2支付宝 0 余额
  321. };
  322. // if (this.payStatus == 12) {
  323. // let locationObj = uni.getStorageSync('locationObj')
  324. // data.longitude = locationObj.longitude.toFixed(4)
  325. // data.latitude = locationObj.latitude.toFixed(4)
  326. // }
  327. // if (this.payStatus == 14) {
  328. // data.card_id = this.card_id
  329. // if (!this.card_id) {
  330. // if (this.banksList.length) {
  331. // return this.$mUtil.toast('请先选择银行卡');
  332. // }
  333. // return this.$mUtil.toast('请先添加银行卡');
  334. // }
  335. // }
  336. this.loading = true;
  337. this.$http.post('/pay/order/pay', data).then(res => {
  338. if (res && res.data.code == 200) {
  339. this.loading = false;
  340. let target = res.data.data;
  341. console.log('target==>>', target)
  342. if (this.payStatus == 1) {
  343. uni.requestPayment({
  344. provider: 'wxpay',
  345. orderInfo: {
  346. appid: target.appid,
  347. noncestr: target.noncestr,
  348. package: target.package,
  349. partnerid: target.partnerid,
  350. prepayid: target.prepayid,
  351. timestamp: target.timestamp,
  352. sign: target.sign
  353. },
  354. success: res => {
  355. this.$mUtil.toast('支付成功');
  356. uni.removeStorageSync('orderreminder');
  357. setTimeout(() => {
  358. if (this.isGroup) {
  359. uni.navigateTo({
  360. url: '/pages/order/gbOrder/gbOrderList'
  361. });
  362. } else if (this.isService) {
  363. uni.navigateTo({
  364. url: '/pages/order/orderList/serviceOrder'
  365. });
  366. } else {
  367. uni.navigateTo({
  368. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  369. });
  370. }
  371. }, 1000);
  372. },
  373. fail: function(err) {
  374. this.loading = false;
  375. console.log('fail:' + JSON.stringify(err));
  376. }
  377. });
  378. } else if (this.payStatus == 2) {
  379. uni.requestPayment({
  380. provider: 'alipay',
  381. orderInfo: target.prePayOrderInfo,
  382. success: res => {
  383. this.$mUtil.toast('支付成功');
  384. uni.removeStorageSync('orderreminder');
  385. setTimeout(() => {
  386. if (this.isGroup) {
  387. uni.navigateTo({
  388. url: '/pages/order/gbOrder/gbOrderList'
  389. });
  390. } else if (this.isService) {
  391. uni.navigateTo({
  392. url: '/pages/order/orderList/serviceOrder'
  393. });
  394. } else {
  395. uni.navigateTo({
  396. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  397. });
  398. }
  399. }, 1000);
  400. },
  401. fail: function(err) {
  402. this.loading = false;
  403. console.log('fail:' + JSON.stringify(err));
  404. }
  405. });
  406. }
  407. // else if (this.payStatus == 10) {
  408. // // #ifdef APP-PLUS
  409. // setTimeout(() => {
  410. // this.showTip()
  411. // }, 3000)
  412. // if (target.expend) {
  413. // this.jumpPay(target.expend.pay_info)
  414. // } else if (target.status == 'failed') {
  415. // this.$mUtil.toast(target.error_msg);
  416. // }
  417. // // #endif
  418. // } else if (this.payStatus == 12) {
  419. // // #ifdef APP-PLUS
  420. // setTimeout(() => {
  421. // this.showTip()
  422. // }, 3000)
  423. // if (target.qrCode) {
  424. // this.jumpPay(target.qrCode)
  425. // } else if (target.orderStatus == 'FAIL') {
  426. // this.$mUtil.toast(target.respMsg);
  427. // }
  428. // // #endif
  429. // } else if (this.payStatus == 14) {
  430. // this.showPayModel = true
  431. // this.payment_id = target.id
  432. // this.codeCount = 10
  433. // this.sms_code = ''
  434. // timer = setInterval(() => {
  435. // this.codeCount--
  436. // if (this.codeCount == 0) {
  437. // clearInterval(timer)
  438. // }
  439. // }, 1000)
  440. // // setTimeout(() => {
  441. // // // uni.navigateTo({
  442. // // // url: `/pages/order/banks/mobileCode?type=pay&payment_id=${target.id}`
  443. // // // })
  444. // // }, 300)
  445. // }
  446. } else {
  447. this.loading = false;
  448. this.$mUtil.toast('交易失败');
  449. }
  450. }).catch(err => {
  451. this.loading = false;
  452. // this.$mUtil.toast('交易失败');
  453. })
  454. } else if (this.payStatus == 0) {
  455. //余额支付
  456. this.loading = false;
  457. uni.showModal({
  458. title: '余额支付',
  459. content: '确定使用余额支付吗?',
  460. success: res => {
  461. if (res.confirm) {
  462. this.$http.post('/order/balance-pay/' + this.orderId).then(res => {
  463. if (res && res.code == 200) {
  464. uni.removeStorageSync('orderreminder');
  465. this.$mUtil.toast('支付成功');
  466. setTimeout(() => {
  467. if (this.isGroup) {
  468. uni.navigateTo({
  469. url: '/pages/order/gbOrder/gbOrderList'
  470. });
  471. } else if (this.isService) {
  472. uni.navigateTo({
  473. url: '/pages/order/orderList/serviceOrder'
  474. });
  475. } else {
  476. uni.navigateTo({
  477. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  478. });
  479. }
  480. }, 1000);
  481. }
  482. });
  483. } else if (res.cancel) {}
  484. }
  485. });
  486. }
  487. },
  488. jumpPay(qrCode) {
  489. if (qrCode) {
  490. let url = `alipays://platformapi/startapp?saId=10000007&qrcode=${qrCode}`
  491. if (plus.os.name == 'iOS') {
  492. plus.runtime.launchApplication({
  493. pname: 'com.eg.android.AlipayGphone',
  494. action: url,
  495. }, err => {
  496. console.log("err:" + JSON.stringify(err))
  497. this.$mUtil.toast('支付跳转失败,请选择其它支付方式');
  498. });
  499. } else if (plus.os.name == 'Android') {
  500. plus.runtime.openURL(url, err => {
  501. console.log("err:" + JSON.stringify(err))
  502. this.$mUtil.toast(JSON.stringify(err));
  503. this.$mUtil.toast('支付跳转失败,请选择其它支付方式');
  504. }, 'com.eg.android.AlipayGphone');
  505. }
  506. }
  507. },
  508. showTip() {
  509. uni.showModal({
  510. title: '确认支付',
  511. content: '请确认当前订单是否支付',
  512. success: (success) => {
  513. if (success.confirm) {
  514. console.log('用户点击确定');
  515. this.$http.get(`/pay/order/sale-detail/${this.orderId}`).then(res => {
  516. if (res && res.code == 200) {
  517. uni.removeStorageSync('orderreminder');
  518. setTimeout(() => {
  519. if (this.isGroup) {
  520. uni.navigateTo({
  521. url: '/pages/order/gbOrder/gbOrderList'
  522. });
  523. } else if (this.isService) {
  524. uni.navigateTo({
  525. url: '/pages/order/orderList/serviceOrder'
  526. });
  527. } else {
  528. uni.navigateTo({
  529. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  530. });
  531. }
  532. }, 1000);
  533. }
  534. });
  535. } else if (success.cancel) {
  536. console.log('用户点击取消');
  537. }
  538. }
  539. });
  540. },
  541. banksHandler() {
  542. uni.navigateTo({
  543. url: '/pages/order/banks/list'
  544. })
  545. },
  546. getBanks() {
  547. this.$http.get('/usercard/list?valid=1').then(res => {
  548. if (res.code == 200) {
  549. this.banksList = res.list
  550. this.banksList.map(item => {
  551. item.logo = this.$mConfig.bankLink + item.local_bank_mark
  552. })
  553. }
  554. })
  555. },
  556. retrySms() {
  557. if (this.codeCount > 0) return this.$mUtil.toast('请稍后重试');
  558. this.codeCount = 10
  559. uni.showLoading({
  560. title: '重发中...',
  561. mask: true
  562. })
  563. this.$http.post('/pay/order/kjRepeatSendSms', {
  564. payment_id: this.payment_id
  565. }).then(res => {
  566. uni.hideLoading()
  567. if (res.code == 200) {
  568. this.$mUtil.toast('短信验证码重发成功');
  569. } else {
  570. this.$mUtil.toast('服务异常! 请重试');
  571. }
  572. }).catch(err => {
  573. uni.hideLoading()
  574. // this.$mUtil.toast('服务异常!');
  575. })
  576. },
  577. payConfirm() {
  578. this.$refs.payModel.clearLoading()
  579. if (!this.sms_code) {
  580. return this.$mUtil.toast('短信验证码不能为空');
  581. }
  582. uni.showLoading({
  583. title: '支付中...',
  584. mask: true
  585. })
  586. // this.loading = true;
  587. this.$http.post('/pay/order/kjPayConfirm', {
  588. payment_id: this.payment_id,
  589. sms_code: this.sms_code
  590. }).then(res => {
  591. if (res.code == 200) {
  592. // uni.hideLoading()
  593. this.getPayStatus()
  594. // uni.hideLoading()
  595. // this.$mUtil.toast("支付成功")
  596. // setTimeout(() => {
  597. // uni.redirectTo({
  598. // url: '/pages/order/orderList/orderList?keys=-1'
  599. // })
  600. // }, 5000)
  601. }
  602. }).catch(err => {
  603. uni.hideLoading()
  604. this.loading = false;
  605. })
  606. },
  607. payCancel() {
  608. this.$mUtil.toast('已取消支付');
  609. this.loading = false;
  610. },
  611. getPayStatus() {
  612. payTimer = setInterval(() => {
  613. this.iPay++
  614. this.lookPayStatus()
  615. if (this.iPay >= 3) {
  616. this.loading = false;
  617. this.showPayModel = false
  618. uni.hideLoading()
  619. clearInterval(payTimer)
  620. uni.redirectTo({
  621. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  622. })
  623. }
  624. }, this.payS)
  625. },
  626. lookPayStatus() {
  627. // this.loading = true;
  628. this.$http.get(`/pay/order/sale-detail-slim/${this.orderId}`).then(res => {
  629. if (res.code == 200) {
  630. if (res.data.payment_status == 5) {
  631. this.loading = false;
  632. uni.hideLoading()
  633. this.showPayModel = false
  634. this.$mUtil.toast("支付成功")
  635. clearInterval(payTimer)
  636. setTimeout(() => {
  637. uni.redirectTo({
  638. url: `/pages/order/orderList/orderList?orderType=${this.payOrder.area_feature==3?3:0}`
  639. })
  640. }, 500)
  641. }
  642. }
  643. }).catch(err => {
  644. uni.hideLoading()
  645. this.loading = false;
  646. })
  647. }
  648. }
  649. };
  650. </script>
  651. <style lang="scss">
  652. page {
  653. background-color: #f5f5f5;
  654. }
  655. .mt82 {
  656. margin-top: 82rpx;
  657. }
  658. radio {
  659. transform: scale(0.7);
  660. }
  661. .pay-select {
  662. margin-top: 66rpx;
  663. border-radius: 18rpx;
  664. padding: 48rpx 38rpx;
  665. .pay {
  666. font-size: 60rpx;
  667. color: #ffa937;
  668. }
  669. .banks {
  670. justify-content: center;
  671. }
  672. .bank {
  673. display: flex;
  674. // flex-direction: column;
  675. justify-content: space-between;
  676. align-items: center;
  677. .box {
  678. // display: flex;
  679. // justify-content: space-between;
  680. // align-items: center;
  681. &:first-child {
  682. margin-bottom: 10rpx;
  683. }
  684. .left {
  685. display: flex;
  686. align-items: center;
  687. margin-bottom: 10rpx;
  688. }
  689. image {
  690. width: 80rpx;
  691. height: auto;
  692. margin-right: 10rpx;
  693. }
  694. .bank_name {
  695. font-size: 28rpx;
  696. margin-right: 20rpx;
  697. // font-weight: bold;
  698. }
  699. .name {
  700. text-align: left;
  701. }
  702. }
  703. }
  704. .bank-box {
  705. flex: 1;
  706. width: 0;
  707. overflow: hidden;
  708. text-overflow: ellipsis;
  709. white-space: nowrap;
  710. }
  711. .bank-icon {
  712. color: #2f77f1;
  713. font-size: 60rpx;
  714. }
  715. }
  716. .img60 {
  717. width: 50rpx;
  718. height: 50rpx;
  719. }
  720. .pay-btn {
  721. margin-top: 80rpx;
  722. display: flex;
  723. flex-direction: column;
  724. align-items: center;
  725. align-content: center;
  726. button {
  727. background-color: #FA6138;
  728. color: #ffffff;
  729. justify-content: center;
  730. }
  731. }
  732. .paybody {
  733. padding: 20rpx 30rpx;
  734. /deep/ .u-input {
  735. border-bottom: 2rpx solid #dcdfe6;
  736. }
  737. .header-text {
  738. margin-bottom: 20rpx;
  739. }
  740. .sms {
  741. display: flex;
  742. align-items: center;
  743. .retry-gary {
  744. display: flex;
  745. align-items: center;
  746. justify-content: center;
  747. width: 180rpx;
  748. margin-left: 40rpx;
  749. padding: 20rpx 10rpx;
  750. background-color: #FA6138;
  751. border-radius: 10rpx;
  752. color: #fff;
  753. }
  754. .retry {
  755. background-color: gray;
  756. }
  757. }
  758. }
  759. .banks-content {
  760. height: 100%;
  761. padding: 80rpx 30rpx 0;
  762. .add {
  763. position: absolute;
  764. top: 30rpx;
  765. left: 30rpx;
  766. font-size: 30rpx;
  767. font-weight: bold;
  768. color: #FA6138;
  769. }
  770. .header {
  771. position: absolute;
  772. top: 30rpx;
  773. left: 50%;
  774. font-size: 30rpx;
  775. font-weight: bold;
  776. transform: translateX(-50%);
  777. }
  778. .no-data-view {
  779. margin-top: 10vh !important;
  780. }
  781. .banks-pay {
  782. display: flex;
  783. justify-content: center;
  784. align-items: center;
  785. width: 80%;
  786. position: fixed;
  787. bottom: 20rpx;
  788. left: 50%;
  789. color: #fff;
  790. border-radius: 10rpx;
  791. padding: 20rpx 0;
  792. text-align: center;
  793. font-size: 30rpx;
  794. transform: translateX(-50%);
  795. background-color: #FA6138;
  796. .txt {
  797. margin-right: 10rpx;
  798. }
  799. }
  800. .banks {
  801. width: 100%;
  802. height: 80%;
  803. overflow: hidden;
  804. .scroll-box {
  805. width: 100%;
  806. height: 100%;
  807. }
  808. }
  809. .item {
  810. // height: 100rpx;
  811. // display: flex;
  812. // align-items: center;
  813. display: block;
  814. padding: 20rpx 0;
  815. border-bottom: 1rpx solid #E6E5E5;
  816. .box {
  817. display: flex;
  818. justify-content: space-between;
  819. align-items: center;
  820. &:first-child {
  821. margin-bottom: 10rpx;
  822. }
  823. .bank_name {
  824. font-size: 30rpx;
  825. font-weight: bold;
  826. }
  827. }
  828. image {
  829. width: 200rpx;
  830. height: auto;
  831. }
  832. .bank-icon {
  833. margin-right: 10rpx;
  834. color: #2f77f1;
  835. font-size: 50rpx;
  836. flex-shrink: 0;
  837. }
  838. .name {
  839. margin-right: 20rpx;
  840. font-size: 26rpx;
  841. overflow: hidden;
  842. text-overflow: ellipsis;
  843. white-space: nowrap;
  844. }
  845. .unbind {
  846. margin-left: auto;
  847. color: red;
  848. flex-shrink: 0;
  849. }
  850. }
  851. .gray {
  852. color: gray;
  853. .bank-icon {
  854. color: gray;
  855. }
  856. }
  857. }
  858. .full-screen {
  859. z-index: 1000;
  860. background-color: rgba(255, 255, 255, 0.5);
  861. }
  862. </style>