registerList.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582
  1. <template>
  2. <view class="content">
  3. <!-- <view class="jg"></view> -->
  4. <view class="navbar">
  5. <view class="nav-item" v-for="(item, index) in registerList" :key="index"
  6. :class="{ current: tabCurrentIndex === index }" @click="tabClick(index)">{{ item.title }}</view>
  7. </view>
  8. <swiper :interval="3000" :duration="200" :style="{'height': height}" class="swiper-wrapper"
  9. :current="tabCurrentIndex" @change="changeTab">
  10. <swiper-item v-for="(item, index) in registerList">
  11. <scroll-view scroll-y="true" :style="{'height': height}">
  12. <empty v-if="item.loaded === true && item.list.length === 0"></empty>
  13. <view v-for="(itemt,index) in item.list" class="list">
  14. <view class="" v-if="itemt.rebuy == 0">
  15. <view class="order-id">账号{{itemt.account}}
  16. <view class="fg">
  17. 注册
  18. </view>
  19. </view>
  20. <view class="time">
  21. <view class="">父接点:{{itemt.account}}</view>
  22. <view class="">接点区域:{{itemt.parent_area}}</view>
  23. </view>
  24. <view class="paynum" v-if="tabCurrentIndex == 0">
  25. 待支付¥{{itemt.pay_price}}
  26. </view>
  27. <view class="zfqx" v-if="tabCurrentIndex == 0">
  28. <view class="btn" @click="openselect(itemt)">
  29. 支付
  30. </view>
  31. <view class="btn qx" @click="cancelRegister(itemt)">
  32. 取消
  33. </view>
  34. </view>
  35. </view>
  36. <view class="" v-if="itemt.rebuy == 1">
  37. <view class="order-id">
  38. 报单编号{{itemt.order_id}}
  39. <view class="fg">
  40. 复购
  41. </view>
  42. </view>
  43. <view class="time">
  44. {{itemt.add_time | getTime}}
  45. </view>
  46. <view class="paynum" v-if="tabCurrentIndex == 0">
  47. 待支付¥{{itemt.pay_price}}
  48. </view>
  49. <view class="zfqx" v-if="tabCurrentIndex == 0">
  50. <view class="btn" @click="openselect(itemt)">
  51. 支付
  52. </view>
  53. <view class="btn qx" @click="cancelRegister(itemt)">
  54. 取消
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. <uni-load-more :status="item.loadingType"></uni-load-more>
  60. </scroll-view>
  61. </swiper-item>
  62. </swiper>
  63. <uni-popup ref="popupPay" type="bottom">
  64. <view class="popup-box">
  65. <view class="popup-pay">
  66. <view class="paybox-top flex">
  67. <view class="type">选择支付方式</view>
  68. <view class="image" @click="close">
  69. <image src="../../static/img/x.png" mode="aspectFill"></image>
  70. </view>
  71. </view>
  72. <view class="paybox-main flex">
  73. <view class="zftype flex">
  74. <image src="../../static/img/weixin.png" mode="aspectFill"></image>
  75. <view class="zf">微信支付</view>
  76. </view>
  77. <label class="radio1" @click="changePayType(1)">
  78. <radio style="transform:scale(0.7)" value="" :checked="paytype == 'weixin'" color="#5dbc7c">
  79. </radio>
  80. </label>
  81. </view>
  82. <view class="paybox-main flex">
  83. <view class="zftype flex">
  84. <image src="../../static/img/yue.png" mode="aspectFill"></image>
  85. <view class="zf">余额支付</view>
  86. </view>
  87. <label class="radio" @click="changePayType(2)">
  88. <radio style="transform:scale(0.7)" class="rad" value="" :checked="paytype == 'yue'"
  89. color="#5dbc7c"></radio>
  90. </label>
  91. </view>
  92. <view class="paybox-main flex">
  93. <view class="zftype flex">
  94. <image src="../../static/img/yong.png" mode="aspectFill"></image>
  95. <view class="zf">佣金支付</view>
  96. </view>
  97. <label class="radio1" @click="changePayType(3)">
  98. <radio style="transform:scale(0.7)" value="" :checked="paytype == 'brokerage'"
  99. color="#5dbc7c"></radio>
  100. </label>
  101. </view>
  102. </view>
  103. <view class="buttom flex">
  104. <view class="heji">
  105. 合计:
  106. <text>
  107. <text class="money">{{ payitem.pay_price }}</text>
  108. </text>
  109. </view>
  110. <view class="zhifu" @click="pay">立即支付</view>
  111. </view>
  112. </view>
  113. </uni-popup>
  114. </view>
  115. </template>
  116. <script>
  117. import uniLoadMore from '@/components/uni-load-more/uni-load-more.vue';
  118. import empty from '@/components/empty';
  119. getTime
  120. import {
  121. getTime
  122. } from '@/utils/rocessor.js';
  123. import {
  124. getRegisterList,
  125. cancelRegister,
  126. payRegister
  127. } from '@/api/user.js'
  128. import {
  129. orderData,
  130. getUserInfo,
  131. service
  132. } from '@/api/user.js';
  133. import {
  134. getSpreadCount
  135. } from '@/api/user.js';
  136. export default {
  137. components: {
  138. uniLoadMore,
  139. empty
  140. },
  141. data() {
  142. return {
  143. payLoding: false, //判断是否支付中
  144. brokerage: 0,
  145. now_money: 0,
  146. payitem: {},
  147. paytype: '',
  148. height: '',
  149. tabCurrentIndex: 0,
  150. registerList: [{
  151. status: 0,
  152. title: '未支付',
  153. loadingType: 'more',
  154. list: [],
  155. page: 1, //当前页数
  156. limit: 10 //每次信息条数
  157. },
  158. {
  159. status: 1,
  160. title: '已支付',
  161. loadingType: 'more',
  162. list: [],
  163. page: 1, //当前页数
  164. limit: 10 //每次信息条数
  165. }
  166. ]
  167. }
  168. },
  169. filters: {
  170. getTime
  171. },
  172. onReady(res) {
  173. var _this = this;
  174. uni.getSystemInfo({
  175. success: resu => {
  176. const query = uni.createSelectorQuery();
  177. query.select('.swiper-wrapper').boundingClientRect();
  178. query.exec(function(res) {
  179. _this.height = resu.windowHeight - res[0].top + 'px';
  180. console.log('打印页面的剩余高度', _this.height);
  181. });
  182. },
  183. fail: res => {}
  184. });
  185. },
  186. onLoad() {
  187. this.getRegisterList()
  188. this.getUserInfo()
  189. },
  190. methods: {
  191. getUserInfo() {
  192. let obj = this
  193. getUserInfo().then(({
  194. data
  195. }) => {
  196. console.log(data, 111)
  197. obj.now_money = +data.now_money
  198. })
  199. getSpreadCount({}, 3).then(({
  200. data
  201. }) => {
  202. console.log(data);
  203. this.brokerage = +data.count;
  204. });
  205. },
  206. //关闭支付弹窗
  207. close() {
  208. this.$refs.popupPay.close();
  209. },
  210. // 修改支付方式
  211. changePayType(type) {
  212. // this.payType = type;
  213. if (type == 1) {
  214. this.paytype = 'weixin';
  215. }
  216. if (type == 2) {
  217. this.paytype = 'yue';
  218. }
  219. if (type == 3) {
  220. this.paytype = 'brokerage';
  221. }
  222. },
  223. getRegisterList(type) {
  224. let obj = this;
  225. let index = obj.tabCurrentIndex;
  226. let navItem = obj.registerList[index];
  227. if (navItem.loadingType == 'loading' || navItem.loadingType == 'noMore') {
  228. return;
  229. }
  230. if (type == 'tabChange' && navItem.loaded == 'loaded') {
  231. return;
  232. }
  233. navItem.loadingType == 'loading';
  234. getRegisterList({
  235. page: navItem.page,
  236. limit: navItem.limit,
  237. type: navItem.status
  238. }).then(res => {
  239. console.log(res, 'ddd')
  240. navItem.list = navItem.list.concat(res.data);
  241. if (navItem.limit == res.data.length) {
  242. navItem.loadingType = 'more';
  243. return;
  244. } else {
  245. navItem.loadingType = 'noMore';
  246. }
  247. uni.hideLoading();
  248. this.$set(navItem, 'loaded', true);
  249. });
  250. },
  251. //顶部tab点击
  252. tabClick(index) {
  253. this.tabCurrentIndex = index;
  254. },
  255. //swiper 切换
  256. changeTab(e) {
  257. this.tabCurrentIndex = e.target.current;
  258. this.getRegisterList('tabChange');
  259. },
  260. //取消订单
  261. cancelRegister(item) {
  262. let obj = this
  263. cancelRegister({}, item.id).then(res => {
  264. uni.showToast({
  265. title: '取消成功',
  266. duration: 2000
  267. });
  268. let s = obj.registerList[obj.tabCurrentIndex].list.indexOf(item);
  269. obj.registerList[obj.tabCurrentIndex].list.splice(s, 1);
  270. }).catch(err => {
  271. console.log(err)
  272. })
  273. },
  274. pay() {
  275. let obj = this;
  276. // 判断是否余额不足
  277. let id = obj.payitem.id
  278. if (obj.paytype == 'yue' && +obj.now_money < +obj.payitem.pay_price) {
  279. uni.showModal({
  280. title: '提示',
  281. content: '账户余额不足!',
  282. showCancel: false,
  283. success: res => {},
  284. fail: () => {},
  285. complete: () => {}
  286. });
  287. return;
  288. }
  289. if (obj.paytype == 'brokerage' && +obj.brokerage < +obj.payitem.pay_price) {
  290. uni.showModal({
  291. title: '提示',
  292. content: '账户佣金不足!',
  293. showCancel: false,
  294. success: res => {},
  295. fail: () => {},
  296. complete: () => {}
  297. });
  298. return;
  299. }
  300. // 支付中
  301. obj.payLoding = true;
  302. uni.showLoading({
  303. title: '支付中',
  304. mask: true
  305. });
  306. // #ifdef H5
  307. // 获取当前是否为微信浏览器
  308. obj.froms = uni.getStorageSync('weichatBrowser') || '';
  309. // #endif
  310. let data = {
  311. paytype: obj.paytype,
  312. // #ifdef H5
  313. from: obj.froms ? 'weixin' : 'H5', //来源
  314. // #endif
  315. // #ifdef MP-WEIXIN
  316. from: 'routine', //来源
  317. // #endif
  318. // #ifdef APP-PLUS
  319. from: 'app' //来源
  320. // #endif
  321. }
  322. payRegister(data, id).then(res => {
  323. uni.hideLoading()
  324. uni.showToast({
  325. title: '支付成功',
  326. duration: 2000
  327. });
  328. let s = obj.registerList[obj.tabCurrentIndex].list.indexOf(item);
  329. obj.registerList[obj.tabCurrentIndex].list.splice(s, 1);
  330. }).catch(err => {
  331. uni.hideLoading()
  332. console.log(err)
  333. })
  334. },
  335. //调出支付选择
  336. openselect(item) {
  337. let obj = this
  338. obj.payitem = item
  339. obj.$refs.popupPay.open();
  340. },
  341. },
  342. }
  343. </script>
  344. <style lang="scss" scoped>
  345. page {
  346. height: 100%;
  347. background-color: #f8f6f6;
  348. }
  349. .content {
  350. height: 100%;
  351. .jg {
  352. height: 20rpx;
  353. background-color: #eee;
  354. }
  355. .navbar {
  356. display: flex;
  357. height: 100rpx;
  358. padding: 0 5rpx;
  359. background: #fff;
  360. box-shadow: 0 1rpx 5rpx rgba(0, 0, 0, 0.06);
  361. position: relative;
  362. z-index: 10;
  363. // margin-top: 25rpx;
  364. .nav-item {
  365. flex: 1;
  366. display: flex;
  367. justify-content: center;
  368. align-items: center;
  369. height: 100%;
  370. font-size: 15px;
  371. color: #999999;
  372. position: relative;
  373. &.current {
  374. color: #333333;
  375. &:after {
  376. content: '';
  377. position: absolute;
  378. left: 50%;
  379. bottom: 0;
  380. transform: translateX(-50%);
  381. width: 44px;
  382. height: 0;
  383. border-bottom: 2px solid #3f7c1f;
  384. }
  385. }
  386. }
  387. }
  388. .swiper-wrapper {}
  389. }
  390. .list {
  391. padding: 30rpx 30rpx 20rpx;
  392. background-color: #fff;
  393. margin-bottom: 20rpx;
  394. .paynum {
  395. padding-top: 10rpx;
  396. padding-bottom: 10rpx;
  397. font-size: 30rpx;
  398. font-family: PingFang SC;
  399. font-weight: bold;
  400. color: #FF0000;
  401. }
  402. .order-id {
  403. font-size: 30rpx;
  404. font-family: PingFang SC;
  405. font-weight: 500;
  406. color: #333;
  407. position: relative;
  408. .fg {
  409. line-height: 40rpx;
  410. width: 80rpx;
  411. background-color: #3F7C1F;
  412. border-radius: 10rpx;
  413. color: #fff;
  414. font-size: 24rpx;
  415. text-align: center;
  416. position: absolute;
  417. right: 0;
  418. top: 0;
  419. }
  420. }
  421. .time {
  422. padding-top: 10rpx;
  423. padding-bottom: 10rpx;
  424. font-size: 26rpx;
  425. font-family: PingFang SC;
  426. font-weight: 500;
  427. color: #AEAEAE;
  428. display: flex;
  429. view {
  430. margin-right: 20rpx;
  431. }
  432. }
  433. .zfqx {
  434. display: flex;
  435. justify-content: flex-end;
  436. border-top: 1px dashed #999;
  437. padding-top: 20rpx;
  438. .btn {
  439. width: 150rpx;
  440. // height: 50rpx;
  441. // background-color: #d7eeb6;
  442. color: #3F7C1F;
  443. border: 1px solid #3F7C1F;
  444. border-radius: 10rpx;
  445. text-align: center;
  446. line-height: 50rpx;
  447. // color: #FF0000;
  448. }
  449. .qx {
  450. margin-left: 30rpx;
  451. border: #999 solid 1px;
  452. color: #333;
  453. }
  454. }
  455. }
  456. .popup-box {
  457. position: relative;
  458. z-index: 100;
  459. width: 100%;
  460. height: auto;
  461. background: #ffffff;
  462. .popup-pay {
  463. position: relative;
  464. justify-content: space-between;
  465. padding: 0rpx 25rpx 32rpx 25rpx;
  466. .paybox-top {
  467. padding-top: 38rpx;
  468. width: 100%;
  469. .type {
  470. font-size: 28rpx;
  471. font-family: PingFang SC;
  472. font-weight: bold;
  473. color: #333333;
  474. }
  475. .image {
  476. padding-right: 24rpx;
  477. padding-bottom: 10rpx;
  478. image {
  479. width: 16rpx;
  480. height: 16rpx;
  481. }
  482. }
  483. }
  484. .paybox-main {
  485. width: 100%;
  486. margin-top: 54rpx;
  487. .zftype {
  488. padding-left: 5rpx;
  489. image {
  490. width: 38rpx;
  491. height: 40rpx;
  492. }
  493. .zf {
  494. padding-left: 18rpx;
  495. font-size: 28rpx;
  496. font-family: PingFang SC;
  497. font-weight: 400;
  498. color: #3f454b;
  499. }
  500. }
  501. }
  502. }
  503. .buttom {
  504. position: relative;
  505. z-index: 100;
  506. width: 100%;
  507. height: 113rpx;
  508. padding-top: 20rpx;
  509. align-items: center;
  510. .heji {
  511. height: 100%;
  512. width: 50%;
  513. padding-left: 23rpx;
  514. padding-top: 20rpx;
  515. font-size: 28rpx;
  516. font-family: PingFang SC;
  517. font-weight: 400;
  518. color: #3f454b;
  519. text {
  520. font-size: 24rpx;
  521. font-family: PingFang SC;
  522. font-weight: bold;
  523. color: #ff0000;
  524. .money {
  525. font-size: 36rpx;
  526. }
  527. }
  528. }
  529. .zhifu {
  530. width: 50%;
  531. height: 92rpx;
  532. background: #5dbc7c;
  533. text-align: center;
  534. line-height: 92rpx;
  535. font-size: 32rpx;
  536. font-family: PingFang SC;
  537. font-weight: bold;
  538. color: #ffffff;
  539. }
  540. }
  541. }
  542. </style>