order-details.vue 13 KB

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