orderT.vue 14 KB

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