orderT.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. <template>
  2. <view :class="['qn-page-' + theme]" style="height: 100vh">
  3. <view class="content">
  4. <view class="navbar">
  5. <view v-for="(item, index) in navList" :key="index" class="nav-item"
  6. :class="[tabCurrentIndex === index ? 'current' : '']" @click="tabClick(item, index)">
  7. {{ item.text }}
  8. <view class="current-line primary-btn"></view>
  9. </view>
  10. </view>
  11. <swiper :current="tabCurrentIndex" class="swiper-box" duration="300" @change="changeTab">
  12. <swiper-item class="tab-content" v-for="(tabItem, tabIndex) in navList" :key="tabIndex">
  13. <scroll-view @scrolltolower="scrollBootom" scroll-y="true" style="height:100%">
  14. <u-empty v-if="tabItem.list.length == 0" mode="list"></u-empty>
  15. <view v-for="(item, index) in tabItem.list" :key="index" class="order-item">
  16. <view class="clearfix order-no-view">
  17. <text class="float_left order-no-text">{{ $_utils.formatDate(item.createTime) }}</text>
  18. <text class="float_right order-status-text">
  19. {{
  20. tabCurrentIndex === 0
  21. ? '待付款'
  22. : tabCurrentIndex === 1
  23. ? '已支付'
  24. : tabCurrentIndex === 2
  25. ? '已完成'
  26. : ''
  27. }}
  28. </text>
  29. </view>
  30. <view class="goods-ul" style="display: flex;">
  31. <block v-for="(it, gindex) in item.project" :key="gindex">
  32. <view class="goods-li clearfix" v-if="gindex <= 4" style="flex-shrink: 0;">
  33. <image class="goods-img float_left" :src="it.image" mode="aspectFill"></image>
  34. </view>
  35. <view class="" style="padding-left: 10rpx;">
  36. {{item.project[0].name}}
  37. </view>
  38. </block>
  39. </view>
  40. <view class="money-view">
  41. 总价:¥{{ item.to_price || '0.00' }}
  42. <view class="price">
  43. 实付款:
  44. <text style="font-size: 20rpx;">¥</text>
  45. <view style="display: inline-block;font-size: 32rpx;">
  46. <rich-text :nodes="$_utils.splitPrice(item.pay_price)"></rich-text>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="middle clearfix">
  51. <!-- #ifdef APP-PLUS||MP-WEIXIN -->
  52. <view class="btnSAdd float_right primary-btn" @click="goPay(item)"
  53. v-if="item.paid == 0">
  54. 去付款
  55. </view>
  56. <view class="btnSAdd float_right primary-btn" @click="goQx(item)"
  57. v-if="item.status == 0">
  58. 取消预约
  59. </view>
  60. <view class="btnSAdd float_right primary-btn" @click="goPage('/pagesT/unit/evaluate?uid=' + item.uid + '&order_id=' + item.id)"
  61. v-if="item.status == 1 && !item.is_evaluate">
  62. 去评价
  63. </view>
  64. <!-- #endif -->
  65. </view>
  66. </view>
  67. <u-loadmore margin-top="20" v-if="tabItem.list.length" :status="tabItem.loadingType" />
  68. </scroll-view>
  69. </swiper-item>
  70. </swiper>
  71. </view>
  72. <u-popup v-model="payPop" mode="bottom" :border-radius="12">
  73. <view class="pay-pop-view">
  74. <view class="pay-sel-title clearfix">
  75. <text class="float_left">付款方式</text>
  76. <text class="float_right ibonfont ibonguanbi" @click="closePayPop"></text>
  77. </view>
  78. <view class="pay-ul">
  79. <view class="pay-li" @click="pay_type = 1">
  80. <text class="ibonfont ibonhuodaofukuan"></text>
  81. <view class="pay-name clearfix"
  82. :class="[order_detail.pay_price*1 > Number(userInfo.memberBalance) ? 'balance-pay-name' : '']">
  83. <view class="float_left">
  84. <text>余额</text>
  85. <text class="balace-num">(余额:¥{{ Number(userInfo.memberBalance) }})</text>
  86. </view>
  87. <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 1"></text>
  88. <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
  89. </view>
  90. </view>
  91. <view class="pay-li" @click="pay_type = 2" v-if="order_detail.pay_price*1 > 0">
  92. <text class="ibonfont ibonweixinzhifu"></text>
  93. <view class="pay-name clearfix ">
  94. <view class="float_left">
  95. <text>微信</text>
  96. </view>
  97. <text class="float_right ibonfont ibonxuanze1" v-if="pay_type == 2"></text>
  98. <text class="float_right ibonfont ibonxuanze1" style="color: #CCCCCC;" v-else></text>
  99. </view>
  100. </view>
  101. </view>
  102. <view class="pay-btn primary-btn" @click="submit">
  103. <text>确定</text>
  104. </view>
  105. </view>
  106. </u-popup>
  107. <u-modal :show-cancel-button="true" :confirm-color="primaryColor" v-model="modal_show" :content="content"
  108. @confirm="confirmEdit" @cancel="cancelEdit"></u-modal>
  109. </view>
  110. </template>
  111. <script>
  112. import CancelOrder from './CancelOrder.vue';
  113. export default {
  114. components: {
  115. CancelOrder
  116. },
  117. data() {
  118. return {
  119. pay_type: 1,
  120. order_detail: {},
  121. payPop: false,
  122. qx_item: {},
  123. content: '请确认是否要取消预约',
  124. modal_show: false,
  125. order_id: 0,
  126. order_status: '',
  127. pay_status: '',
  128. cancel_show: false,
  129. orderList: [],
  130. tabCurrentIndex: 0,
  131. state: 1,
  132. loading_status: 'loadmore',
  133. navList: [{
  134. state: 1,
  135. text: '待付款',
  136. loadingType: 'loadmore',
  137. page: 1,
  138. pageSize: 10,
  139. list: [],
  140. loaded: false
  141. },
  142. {
  143. state: 2,
  144. text: '已支付',
  145. loadingType: 'loadmore',
  146. page: 1,
  147. pageSize: 10,
  148. list: [],
  149. loaded: false
  150. },
  151. {
  152. state: 3,
  153. text: '已完成',
  154. loadingType: 'loadmore',
  155. page: 1,
  156. pageSize: 10,
  157. list: [],
  158. loaded: false
  159. }
  160. ],
  161. page: 1,
  162. pageSize: 10,
  163. pageTotal: 0,
  164. tmplIds: [],
  165. userInfo: {},
  166. };
  167. },
  168. computed: {
  169. // 是否在发货前可以取消订单
  170. // isCancelOrder() {
  171. // return this.$store.state.baseSet.cancelOrder || 5;
  172. // }
  173. // userInfo() {
  174. // return this.$store.state.userStatus;
  175. // }
  176. },
  177. onLoad(opt) {
  178. if(opt.state) {
  179. this.tabCurrentIndex = opt.state
  180. }
  181. // #ifdef MP-WEIXIN
  182. // this.getSettingDataByMessageId();
  183. // #endif
  184. },
  185. onShow() {
  186. // this.getOrderSelect();
  187. this.getCustomerInfo()
  188. },
  189. methods: {
  190. closeCancel() {
  191. this.cancel_show = false;
  192. },
  193. // 点击支付
  194. goPay(item) {
  195. this.order_detail = item
  196. this.payPop = true
  197. },
  198. submit() {
  199. //
  200. let that = this
  201. if(that.pay_type == 1 && (that.order_detail.pay_price*1 > that.userInfo.memberBalance*1)) {
  202. return that.$u.toast('抱歉,您的可用余额不足');
  203. }
  204. that.$u.api.itemPayment({
  205. "id": that.order_detail.id,
  206. "pay_type": that.pay_type, //1余额2微信3支付宝
  207. "source": that.pay_type == 2 ? 3: '',
  208. }).then(({data})=> {
  209. // 余额支付
  210. if(that.pay_type == 1) {
  211. console.log(data)
  212. if(data == '支付成功' || data.data == '支付成功') {
  213. that.payPop = false
  214. uni.showToast({
  215. title: '支付成功'
  216. });
  217. that.getOrderSelect('reload');
  218. that.getCustomerInfo()
  219. }
  220. }
  221. // 微信支付
  222. if(that.pay_type == 2) {
  223. // data.data
  224. let payInfo = data.data
  225. // #ifdef MP-WEIXIN
  226. uni.requestPayment({
  227. provider: 'wxpay',
  228. timeStamp: payInfo.timeStamp, //当前时间
  229. nonceStr: payInfo.nonceStr, //随机字符串,长度在32一下
  230. package: payInfo.package, //统一单接口返回的prepay_id
  231. signType: payInfo.signType, //签名算法,目前支持MD5
  232. paySign: payInfo.paySign, //签名
  233. success: res => {
  234. uni.showToast({
  235. title: '支付成功'
  236. });
  237. that.payPop = false
  238. that.getOrderSelect('reload');
  239. that.getCustomerInfo()
  240. },
  241. fail: async err => {
  242. that.payPop = false
  243. that.$u.toast('支付失败');
  244. that.getOrderSelect('reload');
  245. that.getCustomerInfo()
  246. }
  247. });
  248. // #endif
  249. }
  250. })
  251. },
  252. goQx(item) {
  253. this.qx_item = item;
  254. this.modal_show = true
  255. },
  256. confirmEdit() {
  257. this.$u.api.itemCancel({
  258. id: this.qx_item.id
  259. }).then(res => {
  260. this.getOrderSelect('reload');
  261. })
  262. this.modal_show = false
  263. },
  264. cancelEdit() {
  265. this.qx_item = {}
  266. this.modal_show = false
  267. },
  268. scrollBootom() {
  269. this.getOrderSelect()
  270. },
  271. // 获取订单列表
  272. getOrderSelect(type) {
  273. let that = this
  274. let item = that.navList[that.tabCurrentIndex]
  275. if (type == 'reload' || type == 'tab') {
  276. item.loadingType = 'loadmore'
  277. item.list = []
  278. item.page = 1
  279. }
  280. // if (type == 'tab' && item.loaded) {
  281. // return
  282. // }
  283. if (item.loadingType == 'loading' || item.loadingType == 'nomore') {
  284. return
  285. }
  286. item.loadingType = 'loading'
  287. this.$u.api
  288. .getMyItem({
  289. page: item.page,
  290. pageSize: item.pageSize,
  291. name: '',
  292. type: item.state
  293. })
  294. .then(({data}) => {
  295. item.list = item.list.concat(data)
  296. item.page++
  297. if (item.pageSize == data.length) {
  298. item.loadingType = 'loadmore'
  299. } else {
  300. item.loadingType = 'nomore'
  301. }
  302. item.loaded = true
  303. });
  304. },
  305. //swiper 切换
  306. changeTab(e) {
  307. console.log('swiper拿去数据')
  308. this.tabCurrentIndex = e.target.current;
  309. this.getOrderSelect('tab');
  310. },
  311. //顶部tab点击
  312. tabClick(item, index) {
  313. this.tabCurrentIndex = index;
  314. // this.getOrderSelect('tab');
  315. // this.getOrderSelect()
  316. },
  317. // 获取用户信息
  318. getCustomerInfo() {
  319. this.$u.api.getCustomerInfo().then(({ data }) => {
  320. this.userInfo = data;
  321. this.$store.commit('commit_userStatus', data);
  322. });
  323. },
  324. // 获取消息模版ID 后台取消订单, 退款通知
  325. // getSettingDataByMessageId() {
  326. // this.$u.api
  327. // .getSettingDataByMessageId({
  328. // id: [5, 7]
  329. // })
  330. // .then(res => {
  331. // if (res.data.length > 0) {
  332. // this.tmplIds = res.data.map(item => {
  333. // return item.weixinTemplateId;
  334. // });
  335. // }
  336. // });
  337. // }
  338. }
  339. };
  340. </script>
  341. <style lang="scss">
  342. .order-item {
  343. margin: 24upx 0;
  344. padding-bottom: 24rpx;
  345. background-color: #fff;
  346. .order-no-view {
  347. font-size: 24upx;
  348. padding: 24upx 30upx;
  349. color: #666;
  350. font-weight: 300;
  351. border-bottom: 1upx solid #eee;
  352. .order-status-text {
  353. font-weight: 500;
  354. }
  355. }
  356. .goods-li:last-child {
  357. margin-bottom: 0;
  358. }
  359. .goods-ul {
  360. padding: 20rpx 10rpx 0;
  361. .goods-li {
  362. margin: 0 10rpx;
  363. display: inline-block;
  364. text-align: center;
  365. line-height: 100rpx;
  366. background: #eeeeee;
  367. border-radius: 16rpx;
  368. overflow: hidden;
  369. width: 100upx;
  370. height: 100upx;
  371. .goods-img {
  372. width: 100%;
  373. height: 100%;
  374. }
  375. position: relative;
  376. .buyNum {
  377. position: absolute;
  378. font-size: 20rpx;
  379. color: #ffffff;
  380. line-height: 32rpx;
  381. background-color: rgba($color: #000000, $alpha: 0.6);
  382. padding: 0 10rpx;
  383. right: 0;
  384. bottom: 0;
  385. }
  386. }
  387. }
  388. .goods-li {
  389. // background: #fafafa;
  390. // padding: 30upx 20upx;
  391. // margin-bottom: 20upx;
  392. // margin-right: 10rpx;
  393. .goods-right {
  394. width: 500upx;
  395. margin-left: 20upx;
  396. .goods-name {
  397. color: #333;
  398. font-size: 32upx;
  399. margin-bottom: 19upx;
  400. text-overflow: -o-ellipsis-lastline;
  401. overflow: hidden;
  402. text-overflow: ellipsis;
  403. display: -webkit-box;
  404. -webkit-line-clamp: 1;
  405. line-clamp: 1;
  406. -webkit-box-orient: vertical;
  407. }
  408. .goods-descrip {
  409. font-size: 22upx;
  410. color: #999;
  411. margin-bottom: 28upx;
  412. // font-weight: 300;
  413. text-overflow: -o-ellipsis-lastline;
  414. overflow: hidden;
  415. text-overflow: ellipsis;
  416. display: -webkit-box;
  417. -webkit-line-clamp: 1;
  418. line-clamp: 1;
  419. -webkit-box-orient: vertical;
  420. }
  421. .goods-price {
  422. .price {
  423. color: $price-color;
  424. font-size: 40upx;
  425. }
  426. .sku {
  427. font-size: 22upx;
  428. font-weight: 300;
  429. color: #666;
  430. }
  431. .float_right {
  432. font-size: 24upx;
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .money-view {
  439. color: #666666;
  440. text-align: right;
  441. font-size: 24upx;
  442. padding: 24upx 30upx;
  443. .price {
  444. font-size: 24upx;
  445. font-weight: bold;
  446. color: #000000;
  447. margin-left: 10rpx;
  448. display: inline-block;
  449. }
  450. }
  451. .middle {
  452. font-size: 24upx;
  453. position: relative;
  454. padding: 0 30upx;
  455. }
  456. .btnS {
  457. padding: 0 20upx;
  458. line-height: 50upx;
  459. color: #6e6e6e;
  460. font-size: 24upx;
  461. text-align: center;
  462. margin-left: 20upx;
  463. height: 50upx;
  464. background: rgba(241, 241, 241, 1);
  465. // box-shadow: 0px 2upx 14upx 0px rgba(0, 0, 0, 0.1);
  466. border-radius: 8upx;
  467. }
  468. .btnSAdd {
  469. padding: 0 20upx;
  470. line-height: 50upx;
  471. color: #ffffff;
  472. font-size: 24upx;
  473. text-align: center;
  474. height: 50upx;
  475. border-radius: 8upx;
  476. margin-left: 20rpx;
  477. }
  478. .content {
  479. background: $page-color-base;
  480. height: 100vh;
  481. }
  482. .swiper-box {
  483. height: calc(100% - 80upx);
  484. }
  485. .list-scroll-content {
  486. height: 100%;
  487. }
  488. .navbar {
  489. display: flex;
  490. height: 88upx;
  491. background: #fff;
  492. position: relative;
  493. z-index: 10;
  494. border-bottom: 1upx solid #eee;
  495. .nav-item {
  496. flex: 1;
  497. display: flex;
  498. justify-content: center;
  499. align-items: center;
  500. height: 100%;
  501. font-size: 28upx;
  502. color: #666666;
  503. position: relative;
  504. font-weight: 300;
  505. &.current {
  506. font-weight: 500;
  507. .current-line {
  508. content: '';
  509. position: absolute;
  510. left: 50%;
  511. bottom: 10upx;
  512. transform: translateX(-50%);
  513. width: 40upx;
  514. height: 6upx;
  515. background: $base-btn-bg;
  516. border-radius: 6upx;
  517. /*border-bottom: 2px solid #F53C28;*/
  518. }
  519. }
  520. }
  521. }
  522. .pay-pop-view {
  523. background-color: #ffffff;
  524. border-top-left-radius: 12upx;
  525. border-top-right-radius: 12upx;
  526. font-size: 28upx;
  527. .pay-sel-title {
  528. padding: 0 30upx;
  529. line-height: 88upx;
  530. font-weight: bold;
  531. font-size: 32upx;
  532. .ibonfont {
  533. color: #999;
  534. font-weight: 400;
  535. }
  536. }
  537. .pay-btn {
  538. height: 90upx;
  539. line-height: 90upx;
  540. color: #000;
  541. font-size: 32upx;
  542. text-align: center;
  543. background-color: #108ee9;
  544. }
  545. .pay-ul {
  546. .pay-li {
  547. line-height: 100upx;
  548. .ibonfont {
  549. padding-left: 30upx;
  550. font-size: 46upx;
  551. vertical-align: middle;
  552. margin-right: 24upx;
  553. }
  554. .ibonweixinzhifu {
  555. color: #04be02;
  556. }
  557. .ibonumidd17 {
  558. color: #108ee9;
  559. }
  560. .ibonhuodaofukuan {
  561. color: #f2b844;
  562. }
  563. .pay-name {
  564. width: 650upx;
  565. display: inline-block;
  566. padding-right: 30upx;
  567. vertical-align: middle;
  568. border-bottom: 1px solid #f5f5f5;
  569. .ibonxuanze1,
  570. .ibonweixuanze {
  571. margin-right: 0;
  572. padding-left: 0;
  573. font-size: 38upx;
  574. }
  575. .balace-num {
  576. font-size: 24rpx;
  577. color: #6c6c6c;
  578. }
  579. }
  580. .balance-pay-name {
  581. position: relative;
  582. padding-bottom: 20rpx;
  583. .balance-tip {
  584. position: absolute;
  585. font-size: 22rpx;
  586. line-height: 36rpx;
  587. bottom: 10rpx;
  588. left: 0;
  589. }
  590. }
  591. }
  592. }
  593. }
  594. </style>