order-details.vue 18 KB

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