order-details.vue 13 KB

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