order-details.vue 11 KB

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