order-details.vue 15 KB

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