order-details.vue 16 KB

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