order-details.vue 11 KB

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