order-details.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  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(
  343. `/pages/user/order/order-payment?type=onlinePay&Amount=${
  344. data.order.pendingPayments
  345. }&orderId=${data.order.orderId}`
  346. )
  347. } else {
  348. this.$api.navigateTo(
  349. `/pages/user/order/order-payment?type=payfirm&orderId=${data.order.orderId}`
  350. )
  351. }
  352. }
  353. })
  354. .catch(error => {
  355. this.$util.msg(error.msg, 2000)
  356. })
  357. },
  358. hanldCancelConfirm(data) {
  359. //不使用余额抵扣直接跳转收银台
  360. if (data.onlinePayFlag == '1') {
  361. this.$api.navigateTo(
  362. `/pages/user/order/order-payment?type=onlinePay&Amount=${this.orderInfo.pendingPayments}&orderId=${
  363. data.orderId
  364. }`
  365. )
  366. } else {
  367. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderId=${data.orderId}`)
  368. }
  369. },
  370. hanldConfirmFn(orderId) {
  371. //确认打款供应商
  372. this.$util.modal(
  373. '提示',
  374. '确定委托采美平台打款给供应商吗?确定之前请务必确保货品完好?',
  375. '确定',
  376. '取消',
  377. true,
  378. () => {
  379. this.OrderService.confirmpayment({ orderId: orderId, userId: this.userId })
  380. .then(response => {
  381. this.$util.msg('确认成功', 2000, true, 'success')
  382. setTimeout(() => {
  383. this.getOrderDatainit(this.currentTab)
  384. }, 2000)
  385. })
  386. .catch(error => {
  387. this.$util.msg(error.msg, 2000)
  388. })
  389. }
  390. )
  391. },
  392. handOrderConfirm() {
  393. //确认收货
  394. this.$util.modal('提示', '是否确认收货', '确定', '取消', true, () => {
  395. this.OrderService.ConfirmReceipt({ orderId: this.orderId })
  396. .then(response => {
  397. this.beansType = 7
  398. this.beanNumber = 100
  399. this.isActivityBean = true
  400. })
  401. .catch(error => {
  402. this.$util.msg(error.msg, 2000)
  403. })
  404. })
  405. },
  406. handOrderConfirmation() {
  407. //确认订单
  408. this.$util.modal('提示', '确认此订单?', '确定', '取消', true, () => {
  409. this.OrderService.AffirmOrder({ orderId: this.orderId })
  410. .then(response => {
  411. this.$util.msg(response.msg, 2000, true, 'success')
  412. setTimeout(() => {
  413. this.initOrderDetaileData()
  414. }, 2000)
  415. })
  416. .catch(error => {
  417. this.$util.msg(error.msg, 2000)
  418. })
  419. })
  420. },
  421. handOrderDetele() {
  422. //删除订单
  423. this.$util.modal('提示', '确认删除该订单吗?', '确定', '取消', true, () => {
  424. this.OrderService.DeleteOrder({ orderId: this.orderId })
  425. .then(response => {
  426. this.$util.msg(response.msg, 2000, true, 'success')
  427. setTimeout(() => {
  428. if (this.shareType === 'share') {
  429. this.$api.switchTabTo('/pages/tabBar/home/index')
  430. } else {
  431. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  432. }
  433. }, 500)
  434. })
  435. .catch(error => {
  436. this.$util.msg(error.msg, 2000)
  437. })
  438. })
  439. },
  440. handCenceConfirm() {
  441. //取消订单
  442. this.$util.modal('提示', '确认取消该订单吗?', '确定', '取消', true, () => {
  443. this.OrderService.CancelOrder({ orderId: this.orderId })
  444. .then(response => {
  445. this.$util.msg(response.msg, 2000, true, 'success')
  446. this.initOrderDetaileData()
  447. })
  448. .catch(error => {
  449. this.$util.msg(error.msg, 2000)
  450. })
  451. })
  452. },
  453. onShareAppMessage(res) {
  454. //分享转发
  455. this.isShareModal = false
  456. if (res.from === 'button') {
  457. // 来自页面内转发按钮
  458. }
  459. return {
  460. title: '您有新的分享订单,快来查看吧~',
  461. path: `/pages/user/order/order-sharelogin?orderId=${this.orderId}&userId=${this.userId}`,
  462. imageUrl: 'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  463. }
  464. },
  465. hanldePopupFn(data) {
  466. //监听活动内容
  467. this.popupShow = true
  468. this.handlerPros = data
  469. },
  470. getHeaderTopHeight() {
  471. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  472. let headerPosi = this.headerBtnPosi
  473. let btnPosi = {
  474. // 胶囊实际位置,坐标信息不是左上角原点
  475. height: headerPosi.height,
  476. width: headerPosi.width,
  477. // 胶囊top - 状态栏高度
  478. top: headerPosi.top - statusBarHeight,
  479. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  480. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  481. // 屏幕宽度 - 胶囊right
  482. right: this.systeminfo.screenWidth - headerPosi.right
  483. }
  484. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  485. },
  486. setHeaderBtnPosi() {
  487. // 获得胶囊按钮位置信息
  488. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  489. return headerBtnPosi
  490. },
  491. setSysteminfo() {
  492. let systeminfo
  493. uni.getSystemInfo({
  494. // 获取设备信息
  495. success: res => {
  496. systeminfo = res
  497. }
  498. })
  499. return systeminfo
  500. },
  501. handleBeanlClick() {
  502. //关闭采美豆弹窗
  503. this.isActivityBean = false
  504. this.initOrderDetaileData()
  505. }
  506. },
  507. onShow() {}
  508. }
  509. </script>
  510. <style lang="scss">
  511. page {
  512. height: auto;
  513. background: #f7f7f7;
  514. }
  515. .details {
  516. padding-bottom: 130rpx;
  517. }
  518. .btn-hover {
  519. background: #ffffff;
  520. }
  521. .animation {
  522. /* transition: transform 0.3s ease;*/
  523. transition-property: transform;
  524. transition-duration: 0.3s;
  525. transition-timing-function: ease;
  526. }
  527. .invoice-balance {
  528. width: 702rpx;
  529. height: auto;
  530. padding: 0 24rpx;
  531. background: #ffffff;
  532. float: left;
  533. margin-top: 24rpx;
  534. margin-bottom: 24rpx;
  535. .balabce-t {
  536. width: 100%;
  537. height: 86rpx;
  538. line-height: 86rpx;
  539. font-size: $font-size-28;
  540. color: $text-color;
  541. float: left;
  542. .balabce-t-le {
  543. float: left;
  544. font-weight: bold;
  545. }
  546. .balabce-t-ri {
  547. float: right;
  548. display: flex;
  549. align-items: center;
  550. .money {
  551. display: flex;
  552. float: left;
  553. }
  554. .checkbox-box {
  555. display: flex;
  556. width: 60rpx;
  557. float: left;
  558. height: 100%;
  559. font-size: $font-size-24;
  560. .checkbox {
  561. width: 40rpx;
  562. text-align: right;
  563. box-sizing: border-box;
  564. text-align: center;
  565. text-decoration: none;
  566. border-radius: 0;
  567. -webkit-tap-highlight-color: transparent;
  568. overflow: hidden;
  569. }
  570. }
  571. }
  572. }
  573. .balabce-b {
  574. width: 100%;
  575. float: left;
  576. overflow: hidden;
  577. .balabce-b-text {
  578. width: 100%;
  579. line-height: 58rpx;
  580. font-size: $font-size-24;
  581. color: #ff2a2a;
  582. text-align: right;
  583. float: right;
  584. }
  585. &.balabce-b--hide {
  586. padding: 0 0;
  587. height: 0px;
  588. line-height: 0px;
  589. }
  590. }
  591. }
  592. .clause {
  593. float: right;
  594. font-size: 24rpx;
  595. color: #999999;
  596. margin-top: 60rpx;
  597. margin-right: 24rpx;
  598. &.noclick {
  599. pointer-events: none;
  600. }
  601. .text {
  602. color: #1890f9;
  603. &.color-bg {
  604. color: #333333;
  605. }
  606. }
  607. }
  608. .status-text {
  609. overflow: hidden;
  610. padding: 24rpx;
  611. background: #fff;
  612. font-size: $font-size-26;
  613. .view-type {
  614. float: left;
  615. color: #ff2a2a;
  616. }
  617. .bage-buss {
  618. display: inline-block;
  619. width: 72rpx;
  620. height: 32rpx;
  621. background: radial-gradient(circle, rgba(255, 39, 180, 1) 0%, rgba(193, 77, 245, 1) 100%);
  622. border-radius: 6rpx;
  623. line-height: 32rpx;
  624. text-align: center;
  625. color: #ffffff;
  626. margin-top: 10rpx;
  627. float: right;
  628. }
  629. .bage-auto {
  630. display: inline-block;
  631. width: 72rpx;
  632. height: 32rpx;
  633. background: radial-gradient(circle, rgba(255, 180, 39, 1) 0%, rgba(245, 142, 77, 1) 100%);
  634. border-radius: 6rpx;
  635. line-height: 32rpx;
  636. text-align: center;
  637. color: #ffffff;
  638. margin-top: 10rpx;
  639. float: right;
  640. }
  641. }
  642. </style>