order-details.vue 14 KB

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