order-details.vue 18 KB

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