order-details.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509
  1. <template>
  2. <view class="container details clearfix" :style="{ paddingBottom: isIphoneX ? 130 + 68 + 'rpx' : '130rpx' }">
  3. <!-- 自定义返回 -->
  4. <header-back
  5. :systeminfo="systeminfo"
  6. :navbar-data="nvabarData"
  7. :headerBtnPosi="headerBtnPosi"
  8. :isShare="isOrderShare"
  9. ></header-back>
  10. <tui-skeleton
  11. v-if="!skeletonShow"
  12. backgroundColor="#fafafa"
  13. borderRadius="10rpx"
  14. :isLoading="true"
  15. :loadingType="5"
  16. ></tui-skeleton>
  17. <view v-else class="container-details" :style="{ paddingTop: navbarHeight + 'px' }">
  18. <!-- 地址选择 -->
  19. <order-address ref="orderAddress" v-if="skeletonShow" :addressData="addressData" />
  20. <!-- 商品 -->
  21. <goods-list ref="goods" v-if="skeletonShow" :shopOrderData="shopOrderData" :information="information" />
  22. <!-- <freight-popup :popupShow="popupShow" @show-freight="showFreight"></freight-popup> -->
  23. <!-- 订单信息 -->
  24. <order-information ref="information" v-if="skeletonShow" :information="shopOrderData" />
  25. <!-- 发票信息 -->
  26. <invoice-tent ref="invoice" v-if="skeletonShow" :orderInvoice="orderInvoice" />
  27. <!-- 支付记录 -->
  28. <payment-record
  29. ref="payment"
  30. v-if="skeletonShow && discernReceiptList"
  31. :discernReceiptList="discernReceiptList"
  32. :receiptAmount="receiptAmount"
  33. />
  34. <!-- 退款记录 -->
  35. <refund-record
  36. ref="refund"
  37. v-if="skeletonShow"
  38. :returnedPurchaseList="returnedPurchaseList"
  39. :returnedPurchaseFee="returnedPurchaseFee"
  40. />
  41. <!-- 支付凭证记录 -->
  42. <voucher-record ref="voucher" v-if="skeletonShow && voucherList && voucherList.length > 0" :list="voucherList" />
  43. <!-- 底部button -->
  44. <order-button
  45. ref="orderButton"
  46. v-if="skeletonShow"
  47. :status="btnStatus"
  48. :shareCode="shareCode"
  49. :order="orderInfo"
  50. @buttonConfirm="handButtonConfirm"
  51. />
  52. </view>
  53. <!-- 分享弹窗 -->
  54. <share-alert :orderId="shopOrderId" v-if="isShareModal" @btnConfirm="onShareAppMessage"> </share-alert>
  55. <!-- 提示弹窗 -->
  56. <tui-modal
  57. :show="modal"
  58. @click="handleClick"
  59. :content="contentModalText"
  60. :button="modalButton"
  61. color="#333"
  62. :size="32"
  63. shape="circle"
  64. :maskClosable="false"
  65. >
  66. </tui-modal>
  67. </view>
  68. </template>
  69. <script>
  70. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  71. import orderAddress from './components/details/orderAddress' //地址信息
  72. import goodsList from './components/details/goodsList' //商品列表
  73. import invoiceTent from './components/details/invoiceTent' //发票信息
  74. import orderInformation from './components/details/orderInformation' //订单信息
  75. import paymentRecord from './components/details/paymentRecord' //支付记录
  76. import refundRecord from './components/details/refundRecord' //退款记录
  77. import voucherRecord from './components/details/voucherRecord' //支付凭证记录
  78. import orderButton from './components/details/orderButton' //底部按钮
  79. import shareAlert from '@/components/cm-module/modelAlert/shareAlert.vue' //分享弹窗
  80. import FreightPopup from './components/freight-popup.vue'
  81. export default {
  82. components: {
  83. headerBack,
  84. orderInformation,
  85. orderAddress,
  86. invoiceTent,
  87. goodsList,
  88. paymentRecord,
  89. refundRecord,
  90. voucherRecord,
  91. orderButton,
  92. shareAlert,
  93. FreightPopup,
  94. },
  95. data() {
  96. return {
  97. skeletonShow: false,
  98. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  99. systeminfo: this.setSysteminfo(), //获取设备信息
  100. isIphoneX: this.$store.state.isIphoneX,
  101. CustomBar: this.CustomBar, // 顶部导航栏高度
  102. navbarHeight: '',
  103. nvabarData: {
  104. //顶部自定义导航
  105. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  106. title: '订单详情' // 导航栏 中间的标题
  107. },
  108. state: 0,
  109. userId: '',
  110. orderId: '',
  111. shopOrderId: '',
  112. shareCode: '', //分享码
  113. shareType: '', //分享登录页过来记录的状态
  114. cellPhone: '', //客服电话
  115. payStatus: 0,
  116. btnStatus: 0, //按钮组件状态
  117. onlinePayFlag: '',
  118. isOrderShare: false,
  119. isShareModal: false,
  120. modelType: 0,
  121. orderInfo: {},
  122. alertOrderInfo: {},
  123. addressData: {}, //地址信息初始化
  124. information: {}, //订单信息初始化
  125. shopOrderData: {}, //商品信息初始化
  126. orderInvoice: {}, //发票信息初始化
  127. returnedPurchaseList: [], //退款信息初始化
  128. discernReceiptList: [], //支付信息初始化
  129. voucherList: [], //支付凭证
  130. receiptAmount: 0, //支付金额
  131. returnedPurchaseFee: 0, //退款金额
  132. handleModelEven: 0,
  133. modal: false,
  134. contentModalText: '订单查询失败,请稍候重试~', //操作文字提示语句
  135. modalButton: [
  136. {
  137. text: '取消',
  138. type: 'gray',
  139. plain: true //是否空心
  140. },
  141. {
  142. text: '确定',
  143. customStyle: {
  144. color: '#fff',
  145. bgColor: '#F3B574'
  146. },
  147. plain: false
  148. }
  149. ],
  150. popupShow: false,
  151. }
  152. },
  153. onLoad(option) {
  154. console.log(option)
  155. this.shareType = option.type
  156. this.orderId = option.orderId
  157. this.shopOrderId = option.shopOrderId
  158. if (this.shareType === 'share') {
  159. this.state = 0
  160. this.isOrderShare = true
  161. } else if (option.type === 'confim' || option.type === 'search') {
  162. this.state = 0
  163. } else {
  164. this.state = option.state
  165. }
  166. this.getHeaderTopHeight()
  167. this.initOrderDetaileData()
  168. },
  169. filters: {
  170. TextFormat(status) {
  171. //处理金额
  172. let HtmlText,
  173. typeTextObject = {
  174. 0: '待确认',
  175. 2: '交易完成',
  176. 4: '已关闭',
  177. 5: '交易全退',
  178. 6: '交易全退',
  179. 11: '待付款待发货',
  180. 12: '待付款部分发货',
  181. 13: '待付款已发货',
  182. 21: '部分付款待发货',
  183. 22: '部分付款部分发货',
  184. 23: '部分付款已发货',
  185. 31: '已付款待发货',
  186. 32: '已付款部分发货',
  187. 33: '已付款已发货'
  188. }
  189. Object.keys(typeTextObject).forEach(key => {
  190. if (key == status) {
  191. HtmlText = typeTextObject[key]
  192. }
  193. })
  194. return HtmlText
  195. }
  196. },
  197. methods: {
  198. // showFreight 运费底部上拉框
  199. showFreight($event) {
  200. this.popupShow = $event
  201. },
  202. // 获取订单详情
  203. async initOrderDetaileData() {
  204. try {
  205. const userInfo = await this.$api.getStorage()
  206. this.userId = userInfo.userId ? userInfo.userId : 0
  207. const res = await this.OrderService.QueryOrderDetails({ shopOrderId: this.shopOrderId, userId: this.userId })
  208. const data = res.data
  209. this.skeletonShow = true
  210. this.orderInfo = data.shopOrder
  211. // this.shareCode = data.shareCode
  212. this.addressData = data.userInfo
  213. this.information = data.shopOrder
  214. this.btnStatus = data.shopOrder.status
  215. this.payStatus = data.shopOrder.payStatus
  216. this.payableAmount = data.shopOrder.payableAmount
  217. this.shopOrderData = data.shopOrder
  218. this.orderInvoice = data.orderInvoice
  219. this.onlinePayFlag = data.shopOrder.onlinePayFlag
  220. this.returnedPurchaseList = data.returnedPurchaseList
  221. this.discernReceiptList = data.discernReceiptList
  222. this.voucherList = data.voucher
  223. this.receiptAmount = data.shopOrder.receiptAmount
  224. this.returnedPurchaseFee = data.shopOrder.returnedPurchaseFee
  225. } catch (error) {
  226. //TODO handle the exception
  227. this.$util.msg(error.msg, 2000)
  228. }
  229. },
  230. handButtonConfirm(data) {
  231. //监听点击时间的按钮类型并执行...
  232. this.handShowAlert(data)
  233. },
  234. handShowAlert(data) {
  235. //判断点击的按钮类型并执行...
  236. switch (data.type) {
  237. case 'cancel':
  238. //取消订单
  239. this.modal = true
  240. this.contentModalText = '确认取消该订单吗?'
  241. this.handleModelEven = 1
  242. break
  243. case 'query':
  244. this.$api.navigateTo('/pages/user/order/order-logistics?orderId=' + this.shopOrderId)
  245. break
  246. case 'upload':
  247. this.$api.navigateTo('/pages/user/order/order-addpay?orderId=' + this.shopOrderId)
  248. break
  249. case 'confirm':
  250. //确认收货
  251. this.modal = true
  252. this.contentModalText = '确认收货吗?'
  253. this.handleModelEven = 2
  254. break
  255. case 'pay':
  256. this.getOrderPaymentValidation(data)
  257. break
  258. }
  259. },
  260. getOrderPaymentValidation(data) {
  261. //监听根据付款状态做操作
  262. this.OrderService.OrderPaymentValidation({ shopOrderId: data.orderId })
  263. .then(response => {
  264. let data = response.data
  265. console.log(data)
  266. // if (data.onlinePayFlag == 1) {
  267. // // 只能线下
  268. // this.$api.navigateTo(`/pages/user/pay/card-under?orderId=${data.orderId}`)
  269. // } else {
  270. this.$api.navigateTo(`/pages/user/order/order-pay-list?shopOrderId=${data.shopOrderId}`)
  271. // }
  272. })
  273. .catch(error => {
  274. this.$util.msg(error.msg, 2000)
  275. })
  276. },
  277. handleClick(e) {
  278. //确认操作
  279. if (e.index == 1) {
  280. switch (this.handleModelEven) {
  281. case 1: //取消订单
  282. this.cancelOrder()
  283. break
  284. case 2: //确认收货
  285. this.confirmReceipt()
  286. break
  287. }
  288. }
  289. this.modal = false
  290. },
  291. async confirmReceipt() {
  292. //确认收货
  293. try {
  294. const res = await this.OrderService.ConfirmReceipt({ shopOrderId: this.orderInfo.shopOrderId })
  295. this.$util.msg(res.msg, 2000, true, 'success')
  296. setTimeout(() => {
  297. this.initOrderDetaileData()
  298. }, 2000)
  299. } catch (error) {
  300. this.$util.msg(error.msg, 2000)
  301. }
  302. },
  303. async cancelOrder() {
  304. //取消订单
  305. try {
  306. const res = await this.OrderService.CancelOrder({ shopOrderId: this.orderInfo.shopOrderId, userIdentity: 0 })
  307. this.$util.msg(res.msg, 2000, true, 'success')
  308. setTimeout(() => {
  309. this.initOrderDetaileData()
  310. }, 2000)
  311. } catch (error) {
  312. this.$util.msg(error.msg, 2000)
  313. }
  314. },
  315. onShareAppMessage(res) {
  316. //分享转发
  317. this.isShareModal = false
  318. if (res.from === 'button') {
  319. // 来自页面内转发按钮
  320. }
  321. return {
  322. title: '您有新的分享订单,快来查看吧~',
  323. path: `/pages/user/order/order-sharelogin?shopOrderId=${this.shopOrderId}&userId=${this.userId}`,
  324. imageUrl: 'https://static.caimei365.com/app/mini-mcare/icon/icon_shareOrder@2x.png'
  325. }
  326. },
  327. getHeaderTopHeight() {
  328. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  329. let headerPosi = this.headerBtnPosi
  330. let btnPosi = {
  331. // 胶囊实际位置,坐标信息不是左上角原点
  332. height: headerPosi.height,
  333. width: headerPosi.width,
  334. // 胶囊top - 状态栏高度
  335. top: headerPosi.top - statusBarHeight,
  336. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  337. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  338. // 屏幕宽度 - 胶囊right
  339. right: this.systeminfo.screenWidth - headerPosi.right
  340. }
  341. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  342. },
  343. setHeaderBtnPosi() {
  344. // 获得胶囊按钮位置信息
  345. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  346. return headerBtnPosi
  347. },
  348. setSysteminfo() {
  349. let systeminfo
  350. uni.getSystemInfo({
  351. // 获取设备信息
  352. success: res => {
  353. systeminfo = res
  354. }
  355. })
  356. return systeminfo
  357. }
  358. },
  359. onPullDownRefresh() {//下拉刷新
  360. this.initOrderDetaileData()
  361. uni.stopPullDownRefresh()
  362. },
  363. onShow() {}
  364. }
  365. </script>
  366. <style lang="scss">
  367. page {
  368. height: auto;
  369. background: #f7f7f7;
  370. }
  371. .details {
  372. padding-bottom: 130rpx;
  373. }
  374. .return-instructions {
  375. font-size: 26rpx;
  376. color: #f3b574;
  377. line-height: 42rpx;
  378. padding: 32rpx 50rpx;
  379. background-color: #fffaf8;
  380. text-align: justify;
  381. }
  382. .btn-hover {
  383. background: #ffffff;
  384. }
  385. .animation {
  386. /* transition: transform 0.3s ease;*/
  387. transition-property: transform;
  388. transition-duration: 0.3s;
  389. transition-timing-function: ease;
  390. }
  391. .invoice-balance {
  392. width: 702rpx;
  393. height: auto;
  394. padding: 0 24rpx;
  395. background: #ffffff;
  396. float: left;
  397. margin-top: 24rpx;
  398. margin-bottom: 24rpx;
  399. .balabce-t {
  400. width: 100%;
  401. height: 86rpx;
  402. line-height: 86rpx;
  403. font-size: $font-size-28;
  404. color: $text-color;
  405. float: left;
  406. .balabce-t-le {
  407. float: left;
  408. font-weight: bold;
  409. }
  410. .balabce-t-ri {
  411. float: right;
  412. display: flex;
  413. align-items: center;
  414. .money {
  415. display: flex;
  416. float: left;
  417. }
  418. .checkbox-box {
  419. display: flex;
  420. width: 60rpx;
  421. float: left;
  422. height: 100%;
  423. font-size: $font-size-24;
  424. .checkbox {
  425. width: 40rpx;
  426. text-align: right;
  427. box-sizing: border-box;
  428. text-align: center;
  429. text-decoration: none;
  430. border-radius: 0;
  431. -webkit-tap-highlight-color: transparent;
  432. overflow: hidden;
  433. }
  434. }
  435. }
  436. }
  437. .balabce-b {
  438. width: 100%;
  439. float: left;
  440. overflow: hidden;
  441. .balabce-b-text {
  442. width: 100%;
  443. line-height: 58rpx;
  444. font-size: $font-size-24;
  445. color: #ff2a2a;
  446. text-align: right;
  447. float: right;
  448. }
  449. &.balabce-b--hide {
  450. padding: 0 0;
  451. height: 0px;
  452. line-height: 0px;
  453. }
  454. }
  455. }
  456. .clause {
  457. float: right;
  458. font-size: 24rpx;
  459. color: #999999;
  460. margin-top: 60rpx;
  461. margin-right: 24rpx;
  462. &.noclick {
  463. pointer-events: none;
  464. }
  465. .text {
  466. color: #1890f9;
  467. &.color-bg {
  468. color: #333333;
  469. }
  470. }
  471. }
  472. .status-text {
  473. overflow: hidden;
  474. padding: 24rpx;
  475. background: #fff;
  476. font-size: $font-size-26;
  477. .view-type {
  478. float: left;
  479. color: #ff2a2a;
  480. }
  481. .bage-buss {
  482. display: inline-block;
  483. width: 72rpx;
  484. height: 32rpx;
  485. background: radial-gradient(circle, rgba(255, 39, 180, 1) 0%, rgba(193, 77, 245, 1) 100%);
  486. border-radius: 6rpx;
  487. line-height: 32rpx;
  488. text-align: center;
  489. color: #ffffff;
  490. margin-top: 10rpx;
  491. float: right;
  492. }
  493. .bage-auto {
  494. display: inline-block;
  495. width: 72rpx;
  496. height: 32rpx;
  497. background: radial-gradient(circle, rgba(255, 180, 39, 1) 0%, rgba(245, 142, 77, 1) 100%);
  498. border-radius: 6rpx;
  499. line-height: 32rpx;
  500. text-align: center;
  501. color: #ffffff;
  502. margin-top: 10rpx;
  503. float: right;
  504. }
  505. }
  506. </style>