order-details.vue 10.0 KB

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