order-details.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635
  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. <view class="container-details" :style="{ paddingTop: navbarHeight + 'px' }">
  11. <view class="status-text">
  12. <view class="view-type">{{ information.status | TextFormat }}</view>
  13. <text class="bage-buss" v-if="information.orderSubmitType == 3 || information.orderSubmitType == 4"
  14. >协销</text
  15. >
  16. <text
  17. class="bage-auto"
  18. v-if="
  19. information.orderSubmitType == 0 ||
  20. information.orderSubmitType == 1 ||
  21. information.orderSubmitType == 2
  22. "
  23. >自主</text
  24. >
  25. </view>
  26. <!-- 地址选择 -->
  27. <order-address
  28. ref="orderAddress"
  29. v-if="isRequest && !rechargeGoods"
  30. :addressData="addressData"
  31. ></order-address>
  32. <!-- 商品 -->
  33. <goods-list
  34. ref="goods"
  35. v-if="isRequest"
  36. :shopOrderData="shopOrderData"
  37. :information="information"
  38. @popupClick="hanldePopupFn"
  39. ></goods-list>
  40. <!-- 订单信息 -->
  41. <order-information ref="information" v-if="isRequest" :information="information"></order-information>
  42. <!-- 发票信息 -->
  43. <invoice-tent ref="invoice" v-if="isRequest" :orderInvoice="orderInvoice"></invoice-tent>
  44. <!-- 支付记录 -->
  45. <payment-record
  46. ref="payment"
  47. v-if="isRequest"
  48. :discernReceiptList="discernReceiptList"
  49. :receiptAmount="receiptAmount"
  50. ></payment-record>
  51. <!-- 退款记录 -->
  52. <refund-record
  53. ref="refund"
  54. v-if="isRequest"
  55. :returnedPurchaseList="returnedPurchaseList"
  56. :returnedPurchaseFee="returnedPurchaseFee"
  57. ></refund-record>
  58. <view
  59. class="clause"
  60. v-if="information.secondHandOrderFlag != 1 && !orderSubmitType"
  61. @tap.stop="openclauseConten(clauseData.id)"
  62. :class="clauseData.name == '无条款' ? 'noclick' : ''"
  63. >
  64. 售后条款:<label class="text" :class="clauseData.name == '无条款' ? 'color-bg' : ''">{{
  65. clauseData.name
  66. }}</label>
  67. </view>
  68. <!-- 底部button -->
  69. <order-button
  70. ref="orderButton"
  71. v-if="isRequest"
  72. :status="btnStatus"
  73. :shareCode="shareCode"
  74. :order="orderInfo"
  75. @buttonConfirm="handButtonConfirm"
  76. >
  77. </order-button>
  78. </view>
  79. <!-- 付款弹窗 -->
  80. <order-model
  81. v-if="isPayModel"
  82. :payModelData="payModelData"
  83. :modelType="modelType"
  84. @cancelConfirm="hanldCancelConfirm"
  85. @paymentConfirm="hanldPaymentConfirm"
  86. />
  87. <!-- 分享弹窗 -->
  88. <share-alert :orderId="orderId" v-if="isShareModal" @btnConfirm="onShareAppMessage"> </share-alert>
  89. <!-- 促销活动弹窗 -->
  90. <activi-popup :Promotion="handlerPros" :popupShow="popupShow"></activi-popup>
  91. <!-- 采美豆提示弹窗 -->
  92. <activityBean
  93. v-if="isActivityBean"
  94. :show="isActivityBean"
  95. :beansType="beansType"
  96. :beanNumber="beanNumber"
  97. @cancel="handleBeanlClick"
  98. ></activityBean>
  99. </view>
  100. </template>
  101. <script>
  102. import headerBack from '@/components/cm-module/headerNavbar/header-back' //自定义导航
  103. import orderAddress from '@/components/cm-module/orderDetails/orderAddress' //地址信息
  104. import goodsList from '@/components/cm-module/orderDetails/goodsList' //商品列表
  105. import invoiceTent from '@/components/cm-module/orderDetails/invoiceTent' //发票信息
  106. import orderInformation from '@/components/cm-module/orderDetails/orderInformation' //订单信息
  107. import paymentRecord from '@/components/cm-module/orderDetails/paymentRecord' //支付记录
  108. import refundRecord from '@/components/cm-module/orderDetails/refundRecord' //退款记录
  109. import orderButton from '@/components/cm-module/orderDetails/orderButton' //底部按钮
  110. import shareAlert from '@/components/cm-module/modelAlert/shareAlert.vue' //分享弹窗
  111. import orderModel from '@/components/cm-module/modelAlert/order-alert' //付款弹窗
  112. import activiPopup from '@/components/cm-module/orderDetails/activipopu' //促销活动弹窗
  113. import activityBean from '@/components/cm-module/activity/activityBean.vue'
  114. export default {
  115. components: {
  116. headerBack,
  117. orderInformation,
  118. orderAddress,
  119. invoiceTent,
  120. goodsList,
  121. paymentRecord,
  122. refundRecord,
  123. orderButton,
  124. shareAlert,
  125. orderModel,
  126. activiPopup,
  127. activityBean
  128. },
  129. data() {
  130. return {
  131. state: 0,
  132. userId: '',
  133. orderId: '',
  134. shareCode: '', //分享码
  135. shareType: '', //分享登录页过来记录的状态
  136. cellPhone: '', //客服电话
  137. payStatus: 0,
  138. btnStatus: 0, //按钮组件状态
  139. onlinePayFlag: '',
  140. isRequest: false, //是否加载完成渲染子组件
  141. isOrderShare: false,
  142. isShareModal: false,
  143. isPayModel: false,
  144. modelType: 0,
  145. orderInfo: {},
  146. alertOrderInfo: {},
  147. payModelData: {},
  148. addressData: {}, //地址信息初始化
  149. information: {}, //订单信息初始化
  150. shopOrderData: {}, //商品信息初始化
  151. orderInvoice: {}, //发票信息初始化
  152. returnedPurchaseList: {}, //退款信息初始化
  153. discernReceiptList: {}, //支付信息初始化
  154. receiptAmount: 0, //支付金额
  155. returnedPurchaseFee: 0, //退款金额
  156. rechargeGoods: false,
  157. navbarHeight: '',
  158. headerBtnPosi: this.setHeaderBtnPosi(), //获取设备顶部胶囊高度
  159. systeminfo: this.setSysteminfo(), //获取设备信息
  160. isIphoneX: this.$store.state.isIphoneX,
  161. CustomBar: this.CustomBar, // 顶部导航栏高度
  162. popupShow: false,
  163. handlerPros: {},
  164. nvabarData: {
  165. //顶部自定义导航
  166. showCapsule: 1, // 是否显示左上角图标 1表示显示 0表示不显示
  167. title: '订单详情' // 导航栏 中间的标题
  168. },
  169. clauseData: {},
  170. orderSubmitType: false, //自主订单
  171. beansType: 1,
  172. beanNumber: 0,
  173. isActivityBean: false
  174. }
  175. },
  176. onLoad(option) {
  177. console.log(option)
  178. this.shareType = option.type
  179. this.orderId = option.orderId
  180. if (this.shareType === 'share') {
  181. this.state = 0
  182. this.isOrderShare = true
  183. } else if (option.type === 'confim' || option.type === 'search') {
  184. this.state = 0
  185. } else {
  186. this.state = option.state
  187. }
  188. this.getHeaderTopHeight()
  189. this.initOrderDetaileData()
  190. },
  191. filters: {
  192. TextFormat(status) {
  193. //处理金额
  194. let HtmlText,
  195. typeTextObject = {
  196. 0: '待确认',
  197. 4: '交易完成',
  198. 5: '订单完成',
  199. 6: '已关闭',
  200. 7: '交易全退',
  201. 77: '交易全退',
  202. 11: '待付款待发货',
  203. 12: '待付款部分发货',
  204. 13: '待付款已发货',
  205. 21: '部分付款待发货',
  206. 22: '部分付款部分发货',
  207. 23: '部分付款已发货',
  208. 31: '已付款待发货',
  209. 32: '已付款部分发货',
  210. 33: '已付款已发货',
  211. 111: '待付款待发货'
  212. }
  213. Object.keys(typeTextObject).forEach(key => {
  214. if (key == status) {
  215. HtmlText = typeTextObject[key]
  216. }
  217. })
  218. return HtmlText
  219. }
  220. },
  221. methods: {
  222. openclauseConten(id) {
  223. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  224. },
  225. async initOrderDetaileData() {
  226. const userInfo = await this.$api.getStorage()
  227. this.userId = userInfo.userId ? userInfo.userId : 0
  228. //初始化页面数据@参数:订单ID
  229. this.OrderService.QueryOrderDetails({ orderId: this.orderId, userId: this.userId })
  230. .then(response => {
  231. let data = response.data
  232. this.isRequest = true
  233. this.orderInfo = data.order
  234. this.shareCode = data.shareCode
  235. this.addressData = data.userInfo
  236. this.information = data.order
  237. this.rechargeGoods = data.order.rechargeGoods
  238. this.btnStatus = data.order.status
  239. this.payStatus = data.order.payStatus
  240. this.payableAmount = data.order.payableAmount
  241. this.shopOrderData = data.shopOrderList
  242. this.orderInvoice = data.orderInvoice
  243. this.onlinePayFlag = data.order.onlinePayFlag
  244. this.returnedPurchaseList = data.returnedPurchaseList
  245. this.discernReceiptList = data.discernReceiptList
  246. this.receiptAmount = data.order.receiptAmount
  247. this.returnedPurchaseFee = data.order.returnedPurchaseFee
  248. this.clauseData = data.clause
  249. if (
  250. this.information.orderSubmitType == 0 ||
  251. this.information.orderSubmitType == 1 ||
  252. this.information.orderSubmitType == 2
  253. ) {
  254. this.orderSubmitType = true
  255. } else {
  256. this.orderSubmitType = false
  257. }
  258. })
  259. .catch(error => {
  260. this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
  261. this.$api.switchTabTo('/pages/tabBar/home/index')
  262. })
  263. })
  264. },
  265. handButtonConfirm(data) {
  266. //监听点击时间的按钮类型并执行...
  267. this.handShowAlert(data)
  268. },
  269. handShowAlert(data) {
  270. //判断点击的按钮类型并执行...
  271. switch (data.type) {
  272. case 'delete':
  273. this.handOrderDetele()
  274. break
  275. case 'cancel':
  276. this.handCenceConfirm()
  277. break
  278. case 'query':
  279. this.$api.navigateTo('/pages/user/order/order-logistics?orderId=' + this.orderId)
  280. break
  281. case 'confirm':
  282. this.handOrderConfirm()
  283. break
  284. case 'pay':
  285. this.getOrderPaymentValidation(data)
  286. break
  287. case 'confirmation':
  288. this.handOrderConfirmation()
  289. break
  290. case 'payment':
  291. this.hanldConfirmFn(data.orderId)
  292. break
  293. }
  294. },
  295. getOrderPaymentValidation(data) {
  296. //监听根据付款状态做操作
  297. this.OrderService.OrderPaymentValidation({ orderId: data.orderId })
  298. .then(response => {
  299. let dataCode = response.data.code
  300. this.payModelData = response.data
  301. switch (dataCode) {
  302. case 1:
  303. this.isPayModel = true
  304. this.modelType = 1
  305. break
  306. case 2:
  307. this.isPayModel = true
  308. this.modelType = 2
  309. break
  310. case -1:
  311. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  312. break
  313. default:
  314. if (response.data.onlinePayFlag == 1) {
  315. this.$api.navigateTo(
  316. `/pages/user/order/order-payment?type=onlinePay&Amount=${
  317. response.data.pendingPayments
  318. }&orderId=${data.orderId}`
  319. )
  320. } else {
  321. this.$api.navigateTo(
  322. `/pages/user/order/order-payment?type=payfirm&orderId=${data.orderId}`
  323. )
  324. }
  325. }
  326. })
  327. .catch(error => {
  328. this.$util.msg(error.msg, 2000)
  329. })
  330. },
  331. hanldPaymentConfirm(data) {
  332. //余额抵扣跳转
  333. this.OrderService.OrderBalanceDeduction({ orderId: data.order.orderId })
  334. .then(response => {
  335. if (data.type === 2) {
  336. let _data = { orderId: data.order.orderId }
  337. this.$api.navigateTo(
  338. `/pages/user/order/success?type=deduction&data=${JSON.stringify({ data: _data })}`
  339. )
  340. } else {
  341. if (data.order.onlinePayFlag === 1) {
  342. this.$api.navigateTo(`/pages/user/order/order-payunder?orderId=${data.order.orderId}`)
  343. } else {
  344. this.$api.navigateTo(`/pages/user/order/order-pay-list?orderId=${data.order.orderId}`)
  345. }
  346. }
  347. })
  348. .catch(error => {
  349. this.$util.msg(error.msg, 2000)
  350. })
  351. },
  352. hanldCancelConfirm(data) {
  353. //不使用余额抵扣直接跳转收银台
  354. if (data.onlinePayFlag == 1) {// 只能线下
  355. this.$api.navigateTo(`/pages/user/order/order-payunder?orderId=${data.orderId}`)
  356. } else {
  357. this.$api.navigateTo(`/pages/user/order/order-pay-list?orderId=${data.orderId}`)
  358. }
  359. },
  360. hanldConfirmFn(orderId) {
  361. //确认打款供应商
  362. this.$util.modal(
  363. '提示',
  364. '确定委托采美平台打款给供应商吗?确定之前请务必确保货品完好?',
  365. '确定',
  366. '取消',
  367. true,
  368. () => {
  369. this.OrderService.confirmpayment({ orderId: orderId, userId: this.userId })
  370. .then(response => {
  371. this.$util.msg('确认成功', 2000, true, 'success')
  372. setTimeout(() => {
  373. this.getOrderDatainit(this.currentTab)
  374. }, 2000)
  375. })
  376. .catch(error => {
  377. this.$util.msg(error.msg, 2000)
  378. })
  379. }
  380. )
  381. },
  382. handOrderConfirm() {
  383. //确认收货
  384. this.$util.modal('提示', '是否确认收货', '确定', '取消', true, () => {
  385. this.OrderService.ConfirmReceipt({ orderId: this.orderId })
  386. .then(response => {
  387. this.beansType = 7
  388. this.beanNumber = 100
  389. this.isActivityBean = true
  390. })
  391. .catch(error => {
  392. this.$util.msg(error.msg, 2000)
  393. })
  394. })
  395. },
  396. handOrderConfirmation() {
  397. //确认订单
  398. this.$util.modal('提示', '确认此订单?', '确定', '取消', true, () => {
  399. this.OrderService.AffirmOrder({ orderId: this.orderId })
  400. .then(response => {
  401. this.$util.msg(response.msg, 2000, true, 'success')
  402. setTimeout(() => {
  403. this.initOrderDetaileData()
  404. }, 2000)
  405. })
  406. .catch(error => {
  407. this.$util.msg(error.msg, 2000)
  408. })
  409. })
  410. },
  411. handOrderDetele() {
  412. //删除订单
  413. this.$util.modal('提示', '确认删除该订单吗?', '确定', '取消', true, () => {
  414. this.OrderService.DeleteOrder({ orderId: this.orderId })
  415. .then(response => {
  416. this.$util.msg(response.msg, 2000, true, 'success')
  417. setTimeout(() => {
  418. if (this.shareType === 'share') {
  419. this.$api.switchTabTo('/pages/tabBar/home/index')
  420. } else {
  421. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  422. }
  423. }, 500)
  424. })
  425. .catch(error => {
  426. this.$util.msg(error.msg, 2000)
  427. })
  428. })
  429. },
  430. handCenceConfirm() {
  431. //取消订单
  432. this.$util.modal('提示', '确认取消该订单吗?', '确定', '取消', true, () => {
  433. this.OrderService.CancelOrder({ orderId: this.orderId })
  434. .then(response => {
  435. this.$util.msg(response.msg, 2000, true, 'success')
  436. this.initOrderDetaileData()
  437. })
  438. .catch(error => {
  439. this.$util.msg(error.msg, 2000)
  440. })
  441. })
  442. },
  443. onShareAppMessage(res) {
  444. //分享转发
  445. this.isShareModal = false
  446. if (res.from === 'button') {
  447. // 来自页面内转发按钮
  448. }
  449. return {
  450. title: '您有新的分享订单,快来查看吧~',
  451. path: `/pages/user/order/order-sharelogin?orderId=${this.orderId}&userId=${this.userId}`,
  452. imageUrl: 'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  453. }
  454. },
  455. hanldePopupFn(data) {
  456. //监听活动内容
  457. this.popupShow = true
  458. this.handlerPros = data
  459. },
  460. getHeaderTopHeight() {
  461. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  462. let headerPosi = this.headerBtnPosi
  463. let btnPosi = {
  464. // 胶囊实际位置,坐标信息不是左上角原点
  465. height: headerPosi.height,
  466. width: headerPosi.width,
  467. // 胶囊top - 状态栏高度
  468. top: headerPosi.top - statusBarHeight,
  469. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  470. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  471. // 屏幕宽度 - 胶囊right
  472. right: this.systeminfo.screenWidth - headerPosi.right
  473. }
  474. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  475. },
  476. setHeaderBtnPosi() {
  477. // 获得胶囊按钮位置信息
  478. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  479. return headerBtnPosi
  480. },
  481. setSysteminfo() {
  482. let systeminfo
  483. uni.getSystemInfo({
  484. // 获取设备信息
  485. success: res => {
  486. systeminfo = res
  487. }
  488. })
  489. return systeminfo
  490. },
  491. handleBeanlClick() {
  492. //关闭采美豆弹窗
  493. this.isActivityBean = false
  494. this.initOrderDetaileData()
  495. }
  496. },
  497. onShow() {}
  498. }
  499. </script>
  500. <style lang="scss">
  501. page {
  502. height: auto;
  503. background: #f7f7f7;
  504. }
  505. .details {
  506. padding-bottom: 130rpx;
  507. }
  508. .btn-hover {
  509. background: #ffffff;
  510. }
  511. .animation {
  512. /* transition: transform 0.3s ease;*/
  513. transition-property: transform;
  514. transition-duration: 0.3s;
  515. transition-timing-function: ease;
  516. }
  517. .invoice-balance {
  518. width: 702rpx;
  519. height: auto;
  520. padding: 0 24rpx;
  521. background: #ffffff;
  522. float: left;
  523. margin-top: 24rpx;
  524. margin-bottom: 24rpx;
  525. .balabce-t {
  526. width: 100%;
  527. height: 86rpx;
  528. line-height: 86rpx;
  529. font-size: $font-size-28;
  530. color: $text-color;
  531. float: left;
  532. .balabce-t-le {
  533. float: left;
  534. font-weight: bold;
  535. }
  536. .balabce-t-ri {
  537. float: right;
  538. display: flex;
  539. align-items: center;
  540. .money {
  541. display: flex;
  542. float: left;
  543. }
  544. .checkbox-box {
  545. display: flex;
  546. width: 60rpx;
  547. float: left;
  548. height: 100%;
  549. font-size: $font-size-24;
  550. .checkbox {
  551. width: 40rpx;
  552. text-align: right;
  553. box-sizing: border-box;
  554. text-align: center;
  555. text-decoration: none;
  556. border-radius: 0;
  557. -webkit-tap-highlight-color: transparent;
  558. overflow: hidden;
  559. }
  560. }
  561. }
  562. }
  563. .balabce-b {
  564. width: 100%;
  565. float: left;
  566. overflow: hidden;
  567. .balabce-b-text {
  568. width: 100%;
  569. line-height: 58rpx;
  570. font-size: $font-size-24;
  571. color: #ff2a2a;
  572. text-align: right;
  573. float: right;
  574. }
  575. &.balabce-b--hide {
  576. padding: 0 0;
  577. height: 0px;
  578. line-height: 0px;
  579. }
  580. }
  581. }
  582. .clause {
  583. float: right;
  584. font-size: 24rpx;
  585. color: #999999;
  586. margin-top: 60rpx;
  587. margin-right: 24rpx;
  588. &.noclick {
  589. pointer-events: none;
  590. }
  591. .text {
  592. color: #1890f9;
  593. &.color-bg {
  594. color: #333333;
  595. }
  596. }
  597. }
  598. .status-text {
  599. overflow: hidden;
  600. padding: 24rpx;
  601. background: #fff;
  602. font-size: $font-size-26;
  603. .view-type {
  604. float: left;
  605. color: #ff2a2a;
  606. }
  607. .bage-buss {
  608. display: inline-block;
  609. width: 72rpx;
  610. height: 32rpx;
  611. background: radial-gradient(circle, rgba(255, 39, 180, 1) 0%, rgba(193, 77, 245, 1) 100%);
  612. border-radius: 6rpx;
  613. line-height: 32rpx;
  614. text-align: center;
  615. color: #ffffff;
  616. margin-top: 10rpx;
  617. float: right;
  618. }
  619. .bage-auto {
  620. display: inline-block;
  621. width: 72rpx;
  622. height: 32rpx;
  623. background: radial-gradient(circle, rgba(255, 180, 39, 1) 0%, rgba(245, 142, 77, 1) 100%);
  624. border-radius: 6rpx;
  625. line-height: 32rpx;
  626. text-align: center;
  627. color: #ffffff;
  628. margin-top: 10rpx;
  629. float: right;
  630. }
  631. }
  632. </style>