orderT.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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. this.tabCurrentIndex = e.target.current;
  306. // this.getOrderSelect('tab');
  307. },
  308. //顶部tab点击
  309. tabClick(item, index) {
  310. this.tabCurrentIndex = index;
  311. this.getOrderSelect('tab');
  312. // this.getOrderSelect()
  313. },
  314. // 获取用户信息
  315. getCustomerInfo() {
  316. this.$u.api.getCustomerInfo().then(({ data }) => {
  317. this.userInfo = data;
  318. this.$store.commit('commit_userStatus', data);
  319. });
  320. },
  321. // 获取消息模版ID 后台取消订单, 退款通知
  322. // getSettingDataByMessageId() {
  323. // this.$u.api
  324. // .getSettingDataByMessageId({
  325. // id: [5, 7]
  326. // })
  327. // .then(res => {
  328. // if (res.data.length > 0) {
  329. // this.tmplIds = res.data.map(item => {
  330. // return item.weixinTemplateId;
  331. // });
  332. // }
  333. // });
  334. // }
  335. }
  336. };
  337. </script>
  338. <style lang="scss">
  339. .order-item {
  340. margin: 24upx 0;
  341. padding-bottom: 24rpx;
  342. background-color: #fff;
  343. .order-no-view {
  344. font-size: 24upx;
  345. padding: 24upx 30upx;
  346. color: #666;
  347. font-weight: 300;
  348. border-bottom: 1upx solid #eee;
  349. .order-status-text {
  350. font-weight: 500;
  351. }
  352. }
  353. .goods-li:last-child {
  354. margin-bottom: 0;
  355. }
  356. .goods-ul {
  357. padding: 20rpx 10rpx 0;
  358. .goods-li {
  359. margin: 0 10rpx;
  360. display: inline-block;
  361. text-align: center;
  362. line-height: 100rpx;
  363. background: #eeeeee;
  364. border-radius: 16rpx;
  365. overflow: hidden;
  366. width: 100upx;
  367. height: 100upx;
  368. .goods-img {
  369. width: 100%;
  370. height: 100%;
  371. }
  372. position: relative;
  373. .buyNum {
  374. position: absolute;
  375. font-size: 20rpx;
  376. color: #ffffff;
  377. line-height: 32rpx;
  378. background-color: rgba($color: #000000, $alpha: 0.6);
  379. padding: 0 10rpx;
  380. right: 0;
  381. bottom: 0;
  382. }
  383. }
  384. }
  385. .goods-li {
  386. // background: #fafafa;
  387. // padding: 30upx 20upx;
  388. // margin-bottom: 20upx;
  389. // margin-right: 10rpx;
  390. .goods-right {
  391. width: 500upx;
  392. margin-left: 20upx;
  393. .goods-name {
  394. color: #333;
  395. font-size: 32upx;
  396. margin-bottom: 19upx;
  397. text-overflow: -o-ellipsis-lastline;
  398. overflow: hidden;
  399. text-overflow: ellipsis;
  400. display: -webkit-box;
  401. -webkit-line-clamp: 1;
  402. line-clamp: 1;
  403. -webkit-box-orient: vertical;
  404. }
  405. .goods-descrip {
  406. font-size: 22upx;
  407. color: #999;
  408. margin-bottom: 28upx;
  409. // font-weight: 300;
  410. text-overflow: -o-ellipsis-lastline;
  411. overflow: hidden;
  412. text-overflow: ellipsis;
  413. display: -webkit-box;
  414. -webkit-line-clamp: 1;
  415. line-clamp: 1;
  416. -webkit-box-orient: vertical;
  417. }
  418. .goods-price {
  419. .price {
  420. color: $price-color;
  421. font-size: 40upx;
  422. }
  423. .sku {
  424. font-size: 22upx;
  425. font-weight: 300;
  426. color: #666;
  427. }
  428. .float_right {
  429. font-size: 24upx;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. .money-view {
  436. color: #666666;
  437. text-align: right;
  438. font-size: 24upx;
  439. padding: 24upx 30upx;
  440. .price {
  441. font-size: 24upx;
  442. font-weight: bold;
  443. color: #000000;
  444. margin-left: 10rpx;
  445. display: inline-block;
  446. }
  447. }
  448. .middle {
  449. font-size: 24upx;
  450. position: relative;
  451. padding: 0 30upx;
  452. }
  453. .btnS {
  454. padding: 0 20upx;
  455. line-height: 50upx;
  456. color: #6e6e6e;
  457. font-size: 24upx;
  458. text-align: center;
  459. margin-left: 20upx;
  460. height: 50upx;
  461. background: rgba(241, 241, 241, 1);
  462. // box-shadow: 0px 2upx 14upx 0px rgba(0, 0, 0, 0.1);
  463. border-radius: 8upx;
  464. }
  465. .btnSAdd {
  466. padding: 0 20upx;
  467. line-height: 50upx;
  468. color: #ffffff;
  469. font-size: 24upx;
  470. text-align: center;
  471. height: 50upx;
  472. border-radius: 8upx;
  473. margin-left: 20rpx;
  474. }
  475. .content {
  476. background: $page-color-base;
  477. height: 100vh;
  478. }
  479. .swiper-box {
  480. height: calc(100% - 80upx);
  481. }
  482. .list-scroll-content {
  483. height: 100%;
  484. }
  485. .navbar {
  486. display: flex;
  487. height: 88upx;
  488. background: #fff;
  489. position: relative;
  490. z-index: 10;
  491. border-bottom: 1upx solid #eee;
  492. .nav-item {
  493. flex: 1;
  494. display: flex;
  495. justify-content: center;
  496. align-items: center;
  497. height: 100%;
  498. font-size: 28upx;
  499. color: #666666;
  500. position: relative;
  501. font-weight: 300;
  502. &.current {
  503. font-weight: 500;
  504. .current-line {
  505. content: '';
  506. position: absolute;
  507. left: 50%;
  508. bottom: 10upx;
  509. transform: translateX(-50%);
  510. width: 40upx;
  511. height: 6upx;
  512. background: $base-btn-bg;
  513. border-radius: 6upx;
  514. /*border-bottom: 2px solid #F53C28;*/
  515. }
  516. }
  517. }
  518. }
  519. .pay-pop-view {
  520. background-color: #ffffff;
  521. border-top-left-radius: 12upx;
  522. border-top-right-radius: 12upx;
  523. font-size: 28upx;
  524. .pay-sel-title {
  525. padding: 0 30upx;
  526. line-height: 88upx;
  527. font-weight: bold;
  528. font-size: 32upx;
  529. .ibonfont {
  530. color: #999;
  531. font-weight: 400;
  532. }
  533. }
  534. .pay-btn {
  535. height: 90upx;
  536. line-height: 90upx;
  537. color: #000;
  538. font-size: 32upx;
  539. text-align: center;
  540. background-color: #108ee9;
  541. }
  542. .pay-ul {
  543. .pay-li {
  544. line-height: 100upx;
  545. .ibonfont {
  546. padding-left: 30upx;
  547. font-size: 46upx;
  548. vertical-align: middle;
  549. margin-right: 24upx;
  550. }
  551. .ibonweixinzhifu {
  552. color: #04be02;
  553. }
  554. .ibonumidd17 {
  555. color: #108ee9;
  556. }
  557. .ibonhuodaofukuan {
  558. color: #f2b844;
  559. }
  560. .pay-name {
  561. width: 650upx;
  562. display: inline-block;
  563. padding-right: 30upx;
  564. vertical-align: middle;
  565. border-bottom: 1px solid #f5f5f5;
  566. .ibonxuanze1,
  567. .ibonweixuanze {
  568. margin-right: 0;
  569. padding-left: 0;
  570. font-size: 38upx;
  571. }
  572. .balace-num {
  573. font-size: 24rpx;
  574. color: #6c6c6c;
  575. }
  576. }
  577. .balance-pay-name {
  578. position: relative;
  579. padding-bottom: 20rpx;
  580. .balance-tip {
  581. position: absolute;
  582. font-size: 22rpx;
  583. line-height: 36rpx;
  584. bottom: 10rpx;
  585. left: 0;
  586. }
  587. }
  588. }
  589. }
  590. }
  591. </style>