order-details.vue 13 KB

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