order-details.vue 11 KB

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