order-details.vue 15 KB

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