order-details.vue 17 KB

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