order-details.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625
  1. <template>
  2. <view class="container details clearfix" :style="{ paddingBottom: isIphoneX ? 130 + 68 + 'rpx' : '130rpx' }">
  3. <!-- 自定义返回 -->
  4. <header-order
  5. :systeminfo="systeminfo"
  6. :navbar-data="nvabarData"
  7. :headerBtnPosi="headerBtnPosi"
  8. :isShare="isOrderShare"
  9. >
  10. </header-order>
  11. <view class="container-details" :style="{ paddingTop: navbarHeight + 'px' }">
  12. <view class="status-text">
  13. <view class="view-type">{{ information.status | TextFormat }}</view>
  14. </view>
  15. <!-- 地址选择 -->
  16. <order-address ref="orderAddress" v-if="isRequest" :addressData="addressData"></order-address>
  17. <!-- 商品 -->
  18. <goods-list
  19. ref="goods"
  20. v-if="isRequest"
  21. :shopOrderData="shopOrderData"
  22. :information="information"
  23. @popupClick="hanldePopupFn"
  24. ></goods-list>
  25. <!-- 订单信息 -->
  26. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  27. <!-- 底部button -->
  28. <order-button
  29. ref="orderButton"
  30. v-if="isRequest"
  31. :status="btnStatus"
  32. :shareCode="shareCode"
  33. :order="orderInfo"
  34. @buttonConfirm="handButtonConfirm"
  35. >
  36. </order-button>
  37. </view>
  38. <!-- 操作弹窗 -->
  39. <tui-modal
  40. :show="modal"
  41. @click="handleClick"
  42. @cancel="hideMobel(1)"
  43. :content="contentModalText"
  44. color="#333"
  45. :size="32"
  46. shape="circle"
  47. :maskClosable="false"
  48. ></tui-modal>
  49. <!-- 再次购买订单商品全部下架弹窗 -->
  50. <tui-modal
  51. :show="modal2"
  52. @click="handleClick2"
  53. @cancel="hideMobel(2)"
  54. shape="circle"
  55. content="订单内商品已全部下架,不能购买!"
  56. :button="button"
  57. ></tui-modal>
  58. <!-- 再次购买部分商品失效弹窗 -->
  59. <tui-modal :show="modal3" @cancel="hideMobel(3)" :custom="true">
  60. <view class="tui-modal-custom">
  61. <view class="tui-modal-custom-text">
  62. <view class="title">以下商品已失效,不能进行购买;是否先将其他商品加入购物车?</view>
  63. <scroll-view scroll-y class="tui-modal-custom-list">
  64. <view class="custom-list" v-for="(invalid, index) in invalidList" :key="index">
  65. <view class="custom-list-image"><image :src="invalid.productImage" mode=""></image></view>
  66. <view class="custom-list-name">{{ invalid.name }}</view>
  67. </view>
  68. </scroll-view>
  69. </view>
  70. <view class="tui-modal-button">
  71. <button class="modal-button cancel" @click="hideMobel(3)">我再想想</button>
  72. <button class="modal-button confirm" @click="handleClick3">加入购物车</button>
  73. </view>
  74. </view>
  75. </tui-modal>
  76. <!-- 促销活动弹窗 -->
  77. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  78. <!-- 加载中 -->
  79. <cm-loading :visible="isSubLoading" :text="loadingText"></cm-loading>
  80. </view>
  81. </template>
  82. <script>
  83. import authorize from '@/common/authorize.js'
  84. import HeaderOrder from '@/components/cm-module/headerNavbar/header-order' //自定义导航
  85. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  86. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  87. import orderInformation from '@/components/cm-module/orderDetails/orderInformation' //订单信息
  88. import transfeRecord from '@/components/cm-module/orderDetails/transfeRecord' //转账信息
  89. import paymentRecord from '@/components/cm-module/orderDetails/paymentRecord' //支付记录
  90. import refundRecord from '@/components/cm-module/orderDetails/refundRecord' //退款记录
  91. import orderButton from '@/components/cm-module/orderDetails/orderButton' //底部按钮
  92. import CmLoading from '@/components/cm-module/cm-loading/cm-loading.vue'
  93. import wechatPay from '@/mixins/wechatPay.js'
  94. export default {
  95. components: {
  96. HeaderOrder,
  97. orderInformation,
  98. orderAddress,
  99. goodsList,
  100. CmLoading,
  101. transfeRecord,
  102. paymentRecord,
  103. refundRecord,
  104. orderButton
  105. },
  106. // 混入
  107. mixins: [wechatPay],
  108. data() {
  109. return {
  110. state: 0,
  111. orderId: '',
  112. shareCode: '', //分享码
  113. shareType: '', //分享登录页过来记录的状态
  114. cellPhone: '', //客服电话
  115. payStatus: 0,
  116. btnStatus: 0, //按钮组件状态
  117. onlinePayFlag: '',
  118. isRequest: false, //是否加载完成渲染子组件
  119. isOrderShare: false,
  120. isConfim: false,
  121. modelType: 0,
  122. orderInfo: {},
  123. alertOrderInfo: {},
  124. addressData: {}, //地址信息初始化
  125. information: {}, //订单信息初始化
  126. shopOrderData: {}, //商品信息初始化
  127. orderInvoice: {}, //发票信息初始化
  128. returnedPurchaseList: {}, //退款信息初始化
  129. discernReceiptList: {}, //支付信息初始化
  130. receiptAmount: 0, //支付金额
  131. returnedPurchaseFee: 0, //退款金额
  132. navbarHeight: '',
  133. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  134. systeminfo: this.setSysteminfo(), //获取设备信息
  135. isIphoneX: this.$store.getters.isIphoneX,
  136. CustomBar: this.CustomBar, // 顶部导航栏高度
  137. popupShow: false,
  138. handlerPros: {},
  139. nvabarData: {
  140. //顶部自定义导航
  141. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  142. title: '订单详情' // 导航栏 中间的标题
  143. },
  144. clauseData: {},
  145. orderSubmitType: false, //自主订单
  146. userId: 0,
  147. modal: false,
  148. modal2: false,
  149. modal3: false,
  150. OperationType: '',
  151. contentModalText: '',
  152. button: [
  153. {
  154. text: '确定',
  155. type: 'danger'
  156. }
  157. ],
  158. invalidList: [],
  159. }
  160. },
  161. onLoad(option) {
  162. console.log(option)
  163. this.$api.getStorage().then(resolve => {
  164. this.userId = resolve.userId ? resolve.userId : 0
  165. })
  166. this.shareType = option.type
  167. this.orderId = option.orderId
  168. if (this.shareType === 'share') {
  169. this.state = 0
  170. this.isOrderShare = true
  171. } else if (option.type === 'confim' || option.type === 'search') {
  172. this.state = 0
  173. this.isConfim = true
  174. } else {
  175. this.state = option.state
  176. }
  177. this.getHeaderTopHeight()
  178. this.GetOrderDetaileData()
  179. },
  180. filters: {
  181. TextFormat(status) {
  182. //处理金额
  183. let HtmlText,
  184. typeTextObject = {
  185. 4: '交易完成',
  186. 5: '订单完成',
  187. 6: '已关闭',
  188. 7: '交易全退',
  189. 77: '交易全退',
  190. 11: '待付款待发货',
  191. 12: '待付款部分发货',
  192. 13: '待付款已发货',
  193. 21: '部分付款待发货',
  194. 22: '部分付款部分发货',
  195. 23: '部分付款已发货',
  196. 31: '已付款待发货',
  197. 32: '已付款部分发货',
  198. 33: '已付款已发货',
  199. 111: '待付款待发货'
  200. }
  201. Object.keys(typeTextObject).forEach(key => {
  202. if (key == status) {
  203. HtmlText = typeTextObject[key]
  204. }
  205. })
  206. return HtmlText
  207. }
  208. },
  209. methods: {
  210. openclauseConten(id) {
  211. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  212. },
  213. GetOrderDetaileData() {
  214. //初始化页面数据@参数:订单ID
  215. this.OrderService.QueryOrderDetails({ orderId: this.orderId })
  216. .then(response => {
  217. let resData = response.data
  218. this.isRequest = true
  219. this.orderInfo = resData.order
  220. this.userId = resData.order.userId
  221. this.shareCode = resData.shareCode
  222. this.addressData = resData.userInfo
  223. this.information = resData.order
  224. this.btnStatus = resData.order.status
  225. this.payStatus = resData.order.payStatus
  226. this.payableAmount = resData.order.payableAmount
  227. this.shopOrderData = resData.shopOrderList
  228. this.orderInvoice = resData.orderInvoice
  229. this.onlinePayFlag = resData.order.onlinePayFlag
  230. this.returnedPurchaseList = resData.returnedPurchaseList
  231. this.discernReceiptList = resData.discernReceiptList
  232. this.receiptAmount = resData.order.receiptAmount
  233. this.returnedPurchaseFee = resData.order.returnedPurchaseFee
  234. this.clauseData = resData.clause
  235. if (
  236. this.information.orderSubmitType == 0 ||
  237. this.information.orderSubmitType == 1 ||
  238. this.information.orderSubmitType == 2
  239. ) {
  240. this.orderSubmitType = true
  241. } else {
  242. this.orderSubmitType = false
  243. }
  244. })
  245. .catch(error => {
  246. this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
  247. this.$api.switchTabTo('/pages/tabBar/index/index')
  248. })
  249. })
  250. },
  251. handButtonConfirm(data) {
  252. //获取点击
  253. console.log(data)
  254. this.hanldOrder = data
  255. this.btnoRderID = data.orderId
  256. this.OperationType = data.type
  257. this.handShowAlert(data)
  258. },
  259. handShowAlert(data) {
  260. //执行
  261. switch (data.type) {
  262. case 'cancel':
  263. this.modal = true
  264. this.contentModalText = '确认取消该订单吗?'
  265. break
  266. case 'delete':
  267. this.modal = true
  268. this.contentModalText = '确认删除该订单吗?'
  269. break
  270. case 'confirm':
  271. this.modal = true
  272. this.contentModalText = '是否确认收货?'
  273. break
  274. case 'query':
  275. this.isModalLayer = true
  276. this.$api.navigateTo('/pages/user/order/order-logistics?orderId=' + data.orderId)
  277. break
  278. case 'again':
  279. this.handBuyAgainInfo()
  280. break
  281. case 'pay':
  282. this.miniWxPayFor(data.order)
  283. break
  284. }
  285. },
  286. handleClick(e) {
  287. //用户操作订单
  288. let index = e.index
  289. if (index == 1) {
  290. switch (this.OperationType) {
  291. case 'delete':
  292. this.handOrderDetele(this.orderId)
  293. break
  294. case 'cancel':
  295. this.handCenceConfirm(this.orderId)
  296. break
  297. case 'confirm':
  298. this.handOrderConfirm(this.orderId)
  299. break
  300. }
  301. }
  302. this.modal = false
  303. },
  304. handleClick2() {
  305. this.modal2 = false
  306. },
  307. handleClick3() {
  308. this.handShoppingAgainCart()
  309. this.modal3 = false
  310. },
  311. hideMobel(index) {
  312. switch (index) {
  313. case 1:
  314. this.modal = false
  315. break
  316. case 2:
  317. this.modal2 = false
  318. break
  319. case 3:
  320. this.modal3 = false
  321. break
  322. }
  323. },
  324. handBuyAgainInfo() {
  325. //再次购买初始化查询订单商品信息
  326. this.OrderService.GetOrderBuyAgain({
  327. orderId: this.orderId
  328. })
  329. .then(response => {
  330. this.handShoppingAgainCart()
  331. })
  332. .catch(error => {
  333. console.log(error.data)
  334. if (error.data && error.data.length > 0) {
  335. this.modal3 = true
  336. this.invalidList = error.data
  337. } else {
  338. this.modal2 = true
  339. }
  340. })
  341. },
  342. handShoppingAgainCart() {
  343. //一键加入购物车
  344. this.ProductService.ShoppingAgainCart({
  345. orderId: this.orderId
  346. })
  347. .then(response => {
  348. this.ProductService.QueryShoppingQuantity({ userId: this.userId })
  349. .then(response => {
  350. this.$api.switchTabTo('/pages/tabBar/cart/index')
  351. })
  352. .catch(error => {
  353. console.log('查询购物车数量错误信息', error)
  354. })
  355. })
  356. .catch(error => {
  357. this.$util.msg(error.msg, 2000)
  358. })
  359. },
  360. handOrderConfirm(id) {
  361. //确认收货
  362. this.OrderService.ConfirmReceipt({ orderId: id })
  363. .then(response => {
  364. this.$util.msg(response.msg, 2000, true, 'success')
  365. setTimeout(() => {
  366. this.GetOrderDetaileData(this.currentTab)
  367. }, 2000)
  368. })
  369. .catch(error => {
  370. this.$util.msg(error.msg, 2000)
  371. })
  372. },
  373. handOrderDetele(id) {
  374. //删除订单
  375. this.OrderService.DeleteOrder({ orderId: id })
  376. .then(response => {
  377. this.$util.msg(response.msg, 2000, true, 'success')
  378. setTimeout(() => {
  379. uni.navigateBack({
  380. delta: 1
  381. })
  382. }, 2000)
  383. })
  384. .catch(error => {
  385. this.$util.msg(error.msg, 2000)
  386. })
  387. },
  388. handCenceConfirm(id) {
  389. //取消订单
  390. this.OrderService.CancelOrder({ orderId: id })
  391. .then(response => {
  392. this.$util.msg(response.msg, 2000, true, 'success')
  393. setTimeout(() => {
  394. this.GetOrderDetaileData(this.currentTab)
  395. }, 2000)
  396. })
  397. .catch(error => {
  398. this.$util.msg(error.msg, 2000)
  399. })
  400. },
  401. hanldePopupFn(data) {
  402. //监听活动内容
  403. this.popupShow = true
  404. this.handlerPros = data
  405. },
  406. getHeaderTopHeight() {
  407. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  408. let headerPosi = this.headerBtnPosi
  409. let btnPosi = {
  410. // 胶囊实际位置,坐标信息不是左上角原点
  411. height: headerPosi.height,
  412. width: headerPosi.width,
  413. // 胶囊top - 状态栏高度
  414. top: headerPosi.top - statusBarHeight,
  415. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  416. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  417. // 屏幕宽度 - 胶囊right
  418. right: this.systeminfo.screenWidth - headerPosi.right
  419. }
  420. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  421. },
  422. setHeaderBtnPosi() {
  423. // 获得胶囊按钮位置信息
  424. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  425. return headerBtnPosi
  426. },
  427. setSysteminfo() {
  428. let systeminfo
  429. uni.getSystemInfo({
  430. // 获取设备信息
  431. success: res => {
  432. systeminfo = res
  433. }
  434. })
  435. return systeminfo
  436. }
  437. },
  438. onShow() {}
  439. }
  440. </script>
  441. <style lang="scss">
  442. page {
  443. height: auto;
  444. background: #f7f7f7;
  445. }
  446. .details {
  447. padding-bottom: 130rpx;
  448. }
  449. .btn-hover {
  450. background: #ffffff;
  451. }
  452. .animation {
  453. /* transition: transform 0.3s ease;*/
  454. transition-property: transform;
  455. transition-duration: 0.3s;
  456. transition-timing-function: ease;
  457. }
  458. .invoice-balance {
  459. width: 702rpx;
  460. height: auto;
  461. padding: 0 24rpx;
  462. background: #ffffff;
  463. float: left;
  464. margin-top: 24rpx;
  465. margin-bottom: 24rpx;
  466. .balabce-t {
  467. width: 100%;
  468. height: 86rpx;
  469. line-height: 86rpx;
  470. font-size: $font-size-28;
  471. color: $text-color;
  472. float: left;
  473. .balabce-t-le {
  474. float: left;
  475. font-weight: bold;
  476. }
  477. .balabce-t-ri {
  478. float: right;
  479. display: flex;
  480. align-items: center;
  481. .money {
  482. display: flex;
  483. float: left;
  484. }
  485. .checkbox-box {
  486. display: flex;
  487. width: 60rpx;
  488. float: left;
  489. height: 100%;
  490. font-size: $font-size-24;
  491. .checkbox {
  492. width: 40rpx;
  493. text-align: right;
  494. box-sizing: border-box;
  495. text-align: center;
  496. text-decoration: none;
  497. border-radius: 0;
  498. -webkit-tap-highlight-color: transparent;
  499. overflow: hidden;
  500. }
  501. }
  502. }
  503. }
  504. .balabce-b {
  505. width: 100%;
  506. float: left;
  507. overflow: hidden;
  508. .balabce-b-text {
  509. width: 100%;
  510. line-height: 58rpx;
  511. font-size: $font-size-24;
  512. color: #ff457b;
  513. text-align: right;
  514. float: right;
  515. }
  516. &.balabce-b--hide {
  517. padding: 0 0;
  518. height: 0px;
  519. line-height: 0px;
  520. }
  521. }
  522. }
  523. .clause {
  524. float: right;
  525. font-size: 24rpx;
  526. color: #999999;
  527. margin-top: 60rpx;
  528. margin-right: 24rpx;
  529. &.noclick {
  530. pointer-events: none;
  531. }
  532. .text {
  533. color: #1890f9;
  534. &.color-bg {
  535. color: #333333;
  536. }
  537. }
  538. }
  539. .status-text {
  540. overflow: hidden;
  541. padding: 0 24rpx;
  542. background: #fff;
  543. font-size: $font-size-26;
  544. .view-type {
  545. float: left;
  546. color: $color-system;
  547. }
  548. }
  549. .tui-modal-custom-text {
  550. min-height: 300rpx;
  551. margin-bottom: 30rpx;
  552. .title {
  553. width: 100%;
  554. height: auto;
  555. font-size: $font-size-30;
  556. text-align: justify;
  557. color: #333333;
  558. line-height: 40rpx;
  559. margin-bottom: 30rpx;
  560. }
  561. .tui-modal-custom-list {
  562. width: 100%;
  563. height: 350rpx;
  564. overflow: hidden;
  565. .custom-list {
  566. width: 100%;
  567. height: 117rpx;
  568. box-sizing: border-box;
  569. float: left;
  570. padding: 15rpx 0;
  571. .custom-list-image {
  572. width: 86rpx;
  573. height: 86rpx;
  574. float: left;
  575. border-radius: 6rpx;
  576. box-sizing: border-box;
  577. border: 1px solid #e1e1e1;
  578. image {
  579. width: 84rpx;
  580. height: 84rpx;
  581. border-radius: 6rpx;
  582. display: block;
  583. }
  584. }
  585. .custom-list-name {
  586. width: 400rpx;
  587. height: 86rpx;
  588. float: right;
  589. line-height: 43rpx;
  590. font-size: $font-size-26;
  591. color: #666666;
  592. text-overflow: ellipsis;
  593. overflow: hidden;
  594. display: -webkit-box;
  595. -webkit-line-clamp: 2;
  596. line-clamp: 2;
  597. -webkit-box-orient: vertical;
  598. }
  599. }
  600. }
  601. }
  602. .tui-modal-button {
  603. width: 100%;
  604. height: 72rpx;
  605. display: flex;
  606. .modal-button {
  607. width: 200rpx;
  608. height: 72rpx;
  609. line-height: 72rpx;
  610. border-radius: 36rpx;
  611. box-sizing: border-box;
  612. &.cancel {
  613. border: 1px solid #b2b2b2;
  614. background: #ffffff;
  615. color: #333333;
  616. }
  617. &.confirm {
  618. background: $btn-confirm;
  619. color: #ffffff;
  620. }
  621. }
  622. }
  623. </style>