orderT.vue 16 KB

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