order-details.vue 15 KB

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