order-details.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649
  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.initOrderDetaileData()
  194. },
  195. filters: {
  196. TextFormat(status) {
  197. //处理金额
  198. let HtmlText,
  199. typeTextObject = {
  200. 0: '待确认',
  201. 4: '交易完成',
  202. 5: '订单完成',
  203. 6: '已关闭',
  204. 7: '交易全退',
  205. 77: '交易全退',
  206. 11: '待付款待发货',
  207. 12: '待付款部分发货',
  208. 13: '待付款已发货',
  209. 21: '部分付款待发货',
  210. 22: '部分付款部分发货',
  211. 23: '部分付款已发货',
  212. 31: '已付款待发货',
  213. 32: '已付款部分发货',
  214. 33: '已付款已发货',
  215. 111: '待付款待发货'
  216. }
  217. Object.keys(typeTextObject).forEach(key => {
  218. if (key == status) {
  219. HtmlText = typeTextObject[key]
  220. }
  221. })
  222. return HtmlText
  223. }
  224. },
  225. methods: {
  226. openclauseConten(id) {
  227. this.$api.navigateTo(`/pages/service/sellconten?clauseId=${id}`)
  228. },
  229. async initOrderDetaileData() {
  230. const userInfo = await this.$api.getStorage()
  231. this.userId = userInfo.userId ? userInfo.userId : 0
  232. //初始化页面数据@参数:订单ID
  233. this.OrderService.QueryOrderDetails({ orderId: this.orderId, userId: this.userId })
  234. .then(response => {
  235. let data = response.data
  236. this.isRequest = true
  237. this.orderInfo = data.order
  238. this.shareCode = data.shareCode
  239. this.addressData = data.userInfo
  240. this.information = data.order
  241. this.rechargeGoods = data.order.rechargeGoods
  242. this.btnStatus = data.order.status
  243. this.payStatus = data.order.payStatus
  244. this.payableAmount = data.order.payableAmount
  245. this.shopOrderData = data.shopOrderList
  246. this.orderInvoice = data.orderInvoice
  247. this.onlinePayFlag = data.order.onlinePayFlag
  248. this.returnedPurchaseList = data.returnedPurchaseList
  249. this.discernReceiptList = data.discernReceiptList
  250. this.receiptAmount = data.order.receiptAmount
  251. this.returnedPurchaseFee = data.order.returnedPurchaseFee
  252. this.clauseData = data.clause
  253. if (
  254. this.information.orderSubmitType == 0 ||
  255. this.information.orderSubmitType == 1 ||
  256. this.information.orderSubmitType == 2
  257. ) {
  258. this.orderSubmitType = true
  259. } else {
  260. this.orderSubmitType = false
  261. }
  262. })
  263. .catch(error => {
  264. this.$util.modal('提示', '订单查询失败,请稍后重试~', '确定', '', false, () => {
  265. this.$api.switchTabTo('/pages/tabBar/home/index')
  266. })
  267. })
  268. },
  269. handButtonConfirm(data) {
  270. //监听点击时间的按钮类型并执行...
  271. this.handShowAlert(data)
  272. },
  273. handShowAlert(data) {
  274. //判断点击的按钮类型并执行...
  275. switch (data.type) {
  276. case 'delete':
  277. this.handOrderDetele()
  278. break
  279. case 'cancel':
  280. this.handCenceConfirm()
  281. break
  282. case 'query':
  283. this.$api.navigateTo('/pages/user/order/order-logistics?orderId=' + this.orderId)
  284. break
  285. case 'confirm':
  286. this.handOrderConfirm()
  287. break
  288. case 'pay':
  289. this.getOrderPaymentValidation(data)
  290. break
  291. case 'confirmation':
  292. this.handOrderConfirmation()
  293. break
  294. case 'payment':
  295. this.hanldConfirmFn(data.orderId)
  296. break
  297. }
  298. },
  299. getOrderPaymentValidation(data) {
  300. //监听根据付款状态做操作
  301. this.OrderService.OrderPaymentValidation({ orderId: data.orderId })
  302. .then(response => {
  303. let dataCode = response.data.code
  304. this.payModelData = response.data
  305. switch (dataCode) {
  306. case 1:
  307. this.isPayModel = true
  308. this.modelType = 1
  309. break
  310. case 2:
  311. this.isPayModel = true
  312. this.modelType = 2
  313. break
  314. case -1:
  315. this.$util.modal('', '订单已申请全部退款,无需再付款!', '确定', '', false, () => {})
  316. break
  317. default:
  318. if (response.data.onlinePayFlag == '1') {
  319. this.$api.navigateTo(
  320. `/pages/user/order/order-payment?type=onlinePay&Amount=${
  321. response.data.pendingPayments
  322. }&orderId=${data.orderId}`
  323. )
  324. } else {
  325. this.$api.navigateTo(
  326. `/pages/user/order/order-payment?type=payfirm&orderId=${data.orderId}`
  327. )
  328. }
  329. }
  330. })
  331. .catch(error => {
  332. this.$util.msg(error.msg, 2000)
  333. })
  334. },
  335. hanldPaymentConfirm(data) {
  336. //余额抵扣跳转
  337. this.OrderService.OrderBalanceDeduction({ orderId: data.order.orderId })
  338. .then(response => {
  339. if (data.type === 2) {
  340. let _data = { orderId: data.order.orderId }
  341. this.$api.navigateTo(
  342. `/pages/user/order/success?type=deduction&data=${JSON.stringify({ data: _data })}`
  343. )
  344. } else {
  345. if (data.order.onlinePayFlag === '1') {
  346. this.$api.navigateTo(
  347. `/pages/user/order/order-payment?type=onlinePay&Amount=${
  348. data.order.pendingPayments
  349. }&orderId=${data.order.orderId}`
  350. )
  351. } else {
  352. this.$api.navigateTo(
  353. `/pages/user/order/order-payment?type=payfirm&orderId=${data.order.orderId}`
  354. )
  355. }
  356. }
  357. })
  358. .catch(error => {
  359. this.$util.msg(error.msg, 2000)
  360. })
  361. },
  362. hanldCancelConfirm(data) {
  363. //不使用余额抵扣直接跳转收银台
  364. if (data.onlinePayFlag == '1') {
  365. this.$api.navigateTo(
  366. `/pages/user/order/order-payment?type=onlinePay&Amount=${this.orderInfo.pendingPayments}&orderId=${
  367. data.orderId
  368. }`
  369. )
  370. } else {
  371. this.$api.navigateTo(`/pages/user/order/order-payment?type=payfirm&orderId=${data.orderId}`)
  372. }
  373. },
  374. hanldConfirmFn(orderId) {
  375. //确认打款供应商
  376. this.$util.modal(
  377. '提示',
  378. '确定委托采美平台打款给供应商吗?确定之前请务必确保货品完好?',
  379. '确定',
  380. '取消',
  381. true,
  382. () => {
  383. this.OrderService.confirmpayment({ orderId: orderId, userId: this.userId })
  384. .then(response => {
  385. this.$util.msg('确认成功', 2000, true, 'success')
  386. setTimeout(() => {
  387. this.getOrderDatainit(this.currentTab)
  388. }, 2000)
  389. })
  390. .catch(error => {
  391. this.$util.msg(error.msg, 2000)
  392. })
  393. }
  394. )
  395. },
  396. handOrderConfirm() {
  397. //确认收货
  398. this.$util.modal('提示', '是否确认收货', '确定', '取消', true, () => {
  399. this.OrderService.ConfirmReceipt({ orderId: this.orderId })
  400. .then(response => {
  401. this.beansType = 7
  402. this.beanNumber = 100
  403. this.isActivityBean = true
  404. })
  405. .catch(error => {
  406. this.$util.msg(error.msg, 2000)
  407. })
  408. })
  409. },
  410. handOrderConfirmation() {
  411. //确认订单
  412. this.$util.modal('提示', '确认此订单?', '确定', '取消', true, () => {
  413. this.OrderService.AffirmOrder({ orderId: this.orderId })
  414. .then(response => {
  415. this.$util.msg(response.msg, 2000, true, 'success')
  416. setTimeout(() => {
  417. this.initOrderDetaileData()
  418. }, 2000)
  419. })
  420. .catch(error => {
  421. this.$util.msg(error.msg, 2000)
  422. })
  423. })
  424. },
  425. handOrderDetele() {
  426. //删除订单
  427. this.$util.modal('提示', '确认删除该订单吗?', '确定', '取消', true, () => {
  428. this.OrderService.DeleteOrder({ orderId: this.orderId })
  429. .then(response => {
  430. this.$util.msg(response.msg, 2000, true, 'success')
  431. setTimeout(() => {
  432. if (this.shareType === 'share') {
  433. this.$api.switchTabTo('/pages/tabBar/home/index')
  434. } else {
  435. this.$api.redirectTo(`/pages/user/order/order-list?type=detele&state=${this.state}`)
  436. }
  437. }, 500)
  438. })
  439. .catch(error => {
  440. this.$util.msg(error.msg, 2000)
  441. })
  442. })
  443. },
  444. handCenceConfirm() {
  445. //取消订单
  446. this.$util.modal('提示', '确认取消该订单吗?', '确定', '取消', true, () => {
  447. this.OrderService.CancelOrder({ orderId: this.orderId })
  448. .then(response => {
  449. this.$util.msg(response.msg, 2000, true, 'success')
  450. this.initOrderDetaileData()
  451. })
  452. .catch(error => {
  453. this.$util.msg(error.msg, 2000)
  454. })
  455. })
  456. },
  457. onShareAppMessage(res) {
  458. //分享转发
  459. this.isShareModal = false
  460. if (res.from === 'button') {
  461. // 来自页面内转发按钮
  462. }
  463. return {
  464. title: '您有新的分享订单,快来查看吧~',
  465. path: `/pages/user/order/order-sharelogin?orderId=${this.orderId}&userId=${this.userId}`,
  466. imageUrl: 'https://img.caimei365.com/group1/M00/03/95/Cmis216Sk_SABnOFABZCgCzFV_g063.png'
  467. }
  468. },
  469. hanldePopupFn(data) {
  470. //监听活动内容
  471. this.popupShow = true
  472. this.handlerPros = data
  473. },
  474. getHeaderTopHeight() {
  475. let statusBarHeight = this.systeminfo.statusBarHeight // 状态栏高度
  476. let headerPosi = this.headerBtnPosi
  477. let btnPosi = {
  478. // 胶囊实际位置,坐标信息不是左上角原点
  479. height: headerPosi.height,
  480. width: headerPosi.width,
  481. // 胶囊top - 状态栏高度
  482. top: headerPosi.top - statusBarHeight,
  483. // 胶囊bottom - 胶囊height - 状态栏height (现胶囊bottom 为距离导航栏底部的长度)
  484. bottom: headerPosi.bottom - headerPosi.height - statusBarHeight,
  485. // 屏幕宽度 - 胶囊right
  486. right: this.systeminfo.screenWidth - headerPosi.right
  487. }
  488. this.navbarHeight = headerPosi.bottom + btnPosi.bottom // 原胶囊bottom + 现胶囊bottom
  489. },
  490. setHeaderBtnPosi() {
  491. // 获得胶囊按钮位置信息
  492. let headerBtnPosi = uni.getMenuButtonBoundingClientRect()
  493. return headerBtnPosi
  494. },
  495. setSysteminfo() {
  496. let systeminfo
  497. uni.getSystemInfo({
  498. // 获取设备信息
  499. success: res => {
  500. systeminfo = res
  501. }
  502. })
  503. return systeminfo
  504. },
  505. handleBeanlClick() {
  506. //关闭采美豆弹窗
  507. this.isActivityBean = false
  508. this.initOrderDetaileData()
  509. }
  510. },
  511. onShow() {}
  512. }
  513. </script>
  514. <style lang="scss">
  515. page {
  516. height: auto;
  517. background: #f7f7f7;
  518. }
  519. .details {
  520. padding-bottom: 130rpx;
  521. }
  522. .btn-hover {
  523. background: #ffffff;
  524. }
  525. .animation {
  526. /* transition: transform 0.3s ease;*/
  527. transition-property: transform;
  528. transition-duration: 0.3s;
  529. transition-timing-function: ease;
  530. }
  531. .invoice-balance {
  532. width: 702rpx;
  533. height: auto;
  534. padding: 0 24rpx;
  535. background: #ffffff;
  536. float: left;
  537. margin-top: 24rpx;
  538. margin-bottom: 24rpx;
  539. .balabce-t {
  540. width: 100%;
  541. height: 86rpx;
  542. line-height: 86rpx;
  543. font-size: $font-size-28;
  544. color: $text-color;
  545. float: left;
  546. .balabce-t-le {
  547. float: left;
  548. font-weight: bold;
  549. }
  550. .balabce-t-ri {
  551. float: right;
  552. display: flex;
  553. align-items: center;
  554. .money {
  555. display: flex;
  556. float: left;
  557. }
  558. .checkbox-box {
  559. display: flex;
  560. width: 60rpx;
  561. float: left;
  562. height: 100%;
  563. font-size: $font-size-24;
  564. .checkbox {
  565. width: 40rpx;
  566. text-align: right;
  567. box-sizing: border-box;
  568. text-align: center;
  569. text-decoration: none;
  570. border-radius: 0;
  571. -webkit-tap-highlight-color: transparent;
  572. overflow: hidden;
  573. }
  574. }
  575. }
  576. }
  577. .balabce-b {
  578. width: 100%;
  579. float: left;
  580. overflow: hidden;
  581. .balabce-b-text {
  582. width: 100%;
  583. line-height: 58rpx;
  584. font-size: $font-size-24;
  585. color: #ff2a2a;
  586. text-align: right;
  587. float: right;
  588. }
  589. &.balabce-b--hide {
  590. padding: 0 0;
  591. height: 0px;
  592. line-height: 0px;
  593. }
  594. }
  595. }
  596. .clause {
  597. float: right;
  598. font-size: 24rpx;
  599. color: #999999;
  600. margin-top: 60rpx;
  601. margin-right: 24rpx;
  602. &.noclick {
  603. pointer-events: none;
  604. }
  605. .text {
  606. color: #1890f9;
  607. &.color-bg {
  608. color: #333333;
  609. }
  610. }
  611. }
  612. .status-text {
  613. overflow: hidden;
  614. padding: 24rpx;
  615. background: #fff;
  616. font-size: $font-size-26;
  617. .view-type {
  618. float: left;
  619. color: #ff2a2a;
  620. }
  621. .bage-buss {
  622. display: inline-block;
  623. width: 72rpx;
  624. height: 32rpx;
  625. background: radial-gradient(circle, rgba(255, 39, 180, 1) 0%, rgba(193, 77, 245, 1) 100%);
  626. border-radius: 6rpx;
  627. line-height: 32rpx;
  628. text-align: center;
  629. color: #ffffff;
  630. margin-top: 10rpx;
  631. float: right;
  632. }
  633. .bage-auto {
  634. display: inline-block;
  635. width: 72rpx;
  636. height: 32rpx;
  637. background: radial-gradient(circle, rgba(255, 180, 39, 1) 0%, rgba(245, 142, 77, 1) 100%);
  638. border-radius: 6rpx;
  639. line-height: 32rpx;
  640. text-align: center;
  641. color: #ffffff;
  642. margin-top: 10rpx;
  643. float: right;
  644. }
  645. }
  646. </style>